* feat: add response::{Error, Result}
This type makes for efficient use of the `?` operator when in a function
with multiple return error types that all implement `IntoResponse`.
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
* misc adjustments from PR review
* Rename to `ErrorResponse` and `ResultResponse`
* nitpicky docs changes
* update changelog
* changelog wording
* Apply suggestions from code review
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
* axum: Version 0.5.3
* Update axum/CHANGELOG.md
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
* Fix trailing redirection with query parameters
When the request URI matches a route that need a trailing slash, or has an extra trailing slash, the redirect URI is not generated correctly.
This change adds or removes a trailing slash to the path part of the URI, instead of the full URI, preserving query parameters during redirection.
Signed-off-by: David Calavera <david.calavera@gmail.com>
* Make trailing slash logic safer
Extract parts from Uri and recreate it, so it doesn't bump
into corner cases with string manipulation.
Signed-off-by: David Calavera <david.calavera@gmail.com>
* Remove extra assignment.
Signed-off-by: David Calavera <david.calavera@gmail.com>
* Update axum/src/routing/mod.rs
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* changelog
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Remove unnecessary default features for axum from axum-extra
* Update changelog
Co-authored-by: Leon Felix List <uwdxx@student.kit.edu>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Added chunk function to multipart field
This fixes not being able to stream data from a multipart directly into a file or other output.
* doc comment for clarification of usage and &mut self
* fixed formatting
* Corrected example to reflex best practices
* Removed unwrap
* clean up docs
* update changelog
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Change `Handler` to have an associated `Future` type
This removes `#[async_trait]` from `Handler` and replaces that with an
associated `Future` type.
As hinted at in #878 I'm working on something with types that need to
implement `Handler`. I'm doing that by wrapping other `Handler` types so
I can implement `Handler` by simply delegating and thus don't need to
allocate another box for `#[async_trait]`. This change makes that
possible.
It does make `Handler` less ergonomic to implement but thats a very
niche feature so I'm fine with that. It wouldn't be appropriate for
`FromRequest` IMO.
* changelog
* Fix status codes for `JsonRejection` rejections
Fixes#865
* Apply suggestions from code review
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Although this shadows `StreamBody::new()`, having `From` allows for
trivial bounds creation on associated types.
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>