Giter Site home page Giter Site logo

Comments (4)

jbr avatar jbr commented on June 28, 2024 1

I'm going to tentatively close this because it seems like this needs to be application-specific, since there are any number of body encodings that the trillium-method-override library doesn't/shouldn't know about

from trillium.

jbr avatar jbr commented on June 28, 2024

Hey, sorry for the delay on this!

To make sure I understand your suggestion, the goal is to parse the body and check for a given attribute that modifies the http method along the lines of trillium-method-override, which currently only uses a url param? Let me know if I misunderstood the intent

I don't think there's currently a good way to provide a library that does this that can support arbitrary body encodings (json, xml, x-www-urlecoded, etc). I think this is the sort of thing that would be best to handle in an application, by parsing the body from whatever format and putting that into conn state, as well as modifying the method.

from trillium.

jalcine avatar jalcine commented on June 28, 2024

Hm, that makes sense! I think I can add this on my side, but I'd need to figure out how to change the method while a request is being processed. It looks simple enough to do reading https://docs.trillium.rs/src/trillium_method_override/lib.rs.html#94-108

(Originally published at: https://jacky.wtf/2022/5/r-Er)

from trillium.

jbr avatar jbr commented on June 28, 2024

Yep, it's really just conn.inner_mut().set_method(method); (using trillium_http::Conn::set_method) β€”Β And Method has a try_from(&str)

from trillium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.