Comments (4)
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.
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.
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.
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)
- Cannot run nesting router example HOT 2
- Feature suggestion for `trillium-websockets`: Make websocket limits configurable HOT 3
- `trillium-http`: Incorrect handling of http chunks longer than u32::MAX on 32 bit platforms.
- Feature suggestion for `trillium-tera`: live reload (development-mode)
- Feature suggestion for `trillium-router`: Allow `String` or `&str` to be used as the path HOT 3
- Bug report for `trillium-async-std`: Ctrl-C crashes the server on Windows
- feature for all runtime adapters: add the ability to provide a pre-bound TcpListener instead of host+port
- Bug report for `trillium-testing & trillium-static`: Documentation is failing to build on docs.rs HOT 1
- allow to send static compiled file when 404 HOT 8
- Integration with Tracing HOT 1
- Bug report for `trillium`: Conn does not provide access to the `peer_ip` method HOT 1
- Feature suggestion for `trillium-websocket`: Add access to peer_ip from WebSocketConn HOT 4
- trillium on io-uring HOT 1
- Feature suggestion for `trillium-api`: ApiConnExt should include is_json_request() HOT 1
- add set_json in trillium::ApiConnExt HOT 1
- Feature suggestion for `trillium-server-common`: init with TcpListener rather than host and port HOT 2
- Feature suggestion for `trillium`: Lifetimes of Headers::get should be more flexible HOT 1
- Bug report for `trillium`: Headers::get_values is case-sensitive for unknown header names
- CloneCounter: Unnecessary wakes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trillium.