David Pedersen

Results 363 comments of David Pedersen
trafficstars

I think this is closely related to https://github.com/tokio-rs/axum/pull/1154. If axum had its own body type, and a way to construct that from any `B: http_body::Body` then we could use that...

> why does `ContentLengthLimit` exist in `Axum` when we have `tower_http::limit::RequestBodyLimitLayer` in `Tower`, on which `Axum` relies anyway? > What are their biggest differences other than that the former has...

@avdb13 please open a separate issue/discussion about that and please include a minimal reproducible example that we can run.

I think this sounds very promising. I'm gonna explore it!

I give this a quick shut but ran into some issues ```rust trait IntoResponse {} impl IntoResponse for () {} struct Request(B); trait FromRequestOnce: Sized { type Rejection: IntoResponse; fn...

Yeah that was my first though as well but that leads to conflicting impls: ```rust trait FromRequestOnce { type Rejection: IntoResponse; fn from_request_once(req: Request) -> Result; } trait FromRequestMut: Sized...

Something that does work is ```rust trait FromRequestOnce: Sized { type Rejection: IntoResponse; fn from_request_once(req: Request) -> Result; } // this works because there is no blanket impl // but...

Maybes something like this ```rust struct RequestParts(B, PhantomData); struct Mut; struct Owned; impl RequestParts { // fn headers() // fn extensions() // ... } // only `RequestParts` allows you to...

I took stab at implement that in https://github.com/tokio-rs/axum/pull/1121. Looking very promising!

I have been thinking about this and have a proposal now. The reason its hard in the first place is that `Router::route` takes any `T: Service`. So even if we...