Releases: tokio-rs/axum
axum-core - v0.2.3
- added: Add
response::ErrorResponse
andresponse::Result
for
IntoResponse
-based error handling (#921)
axum - v0.5.3
axum - v0.5.2
Yanked, as it contained an accidental breaking change.
axum-core - v0.2.2
- added: Add
AppendHeaders
for appending headers to a response rather than overriding them (#927)
axum - v0.5.1
- added: Add
RequestParts::extract
which allows applying an extractor as a method call ([#897)
axum-extra - v0.2.1
axum-core - v0.2.1
- added: Add
RequestParts::extract
which allows applying an extractor as a method call (#897)
axum - v0.5.0
-
added: Document sharing state between handler and middleware (#783)
-
added:
Extension<_>
can now be used in tuples for building responses, and will set an
extension on the response (#797) -
added:
extract::Host
for extracting the hostname of a request (#827) -
added: Add
IntoResponseParts
trait which allows defining custom response
types for adding headers or extensions to responses (#797) -
added:
TypedHeader
implements the newIntoResponseParts
trait so they
can be returned from handlers as parts of a response (#797) -
changed:
Router::merge
now acceptsInto<Router>
(#819) -
breaking:
sse::Event
now accepts types implementingAsRef<str>
instead ofInto<String>
as field values. -
breaking:
sse::Event
now panics if a setter method is called twice instead of silently
overwriting old values. -
breaking: Require
Output = ()
onWebSocketStream::on_upgrade
(#644) -
breaking: Make
TypedHeaderRejectionReason
#[non_exhaustive]
(#665) -
breaking: Using
HeaderMap
as an extractor will no longer remove the headers and thus
they'll still be accessible to other extractors, such asaxum::extract::Json
. Instead
HeaderMap
will clone the headers. You should prefer to useTypedHeader
to extract only the
headers you need (#698)This includes these breaking changes:
RequestParts::take_headers
has been removed.RequestParts::headers
returns&HeaderMap
.RequestParts::headers_mut
returns&mut HeaderMap
.HeadersAlreadyExtracted
has been removed.- The
HeadersAlreadyExtracted
variant has been removed from these rejections:RequestAlreadyExtracted
RequestPartsAlreadyExtracted
JsonRejection
FormRejection
ContentLengthLimitRejection
WebSocketUpgradeRejection
<HeaderMap as FromRequest<_>>::Rejection
has been changed tostd::convert::Infallible
.
-
breaking:
axum::http::Extensions
is no longer an extractor (ie it
doesn't implementFromRequest
). Theaxum::extract::Extension
extractor is
not impacted by this and works the same. This change makes it harder to
accidentally remove all extensions which would result in confusing errors
elsewhere (#699)
This includes these breaking changes:RequestParts::take_extensions
has been removed.RequestParts::extensions
returns&Extensions
.RequestParts::extensions_mut
returns&mut Extensions
.RequestAlreadyExtracted
has been removed.<Request as FromRequest>::Rejection
is nowBodyAlreadyExtracted
.<http::request::Parts as FromRequest>::Rejection
is nowInfallible
.ExtensionsAlreadyExtracted
has been removed.- The
ExtensionsAlreadyExtracted
removed variant has been removed from these rejections:ExtensionRejection
PathRejection
MatchedPathRejection
WebSocketUpgradeRejection
-
breaking:
Redirect::found
has been removed (#800) -
breaking:
AddExtensionLayer
has been removed. UseExtension
instead. It now implements
tower::Layer
(#807) -
breaking:
AddExtension
has been moved from the root module tomiddleware
-
breaking:
.nest("/foo/", Router::new().route("/bar", _))
now does the right thing and
results in a route at/foo/bar
instead of/foo//bar
(#824) -
breaking: Routes are now required to start with
/
. Previously routes such as:foo
would
be accepted but most likely result in bugs (#823) -
breaking:
Headers
has been removed. Arrays of tuples directly implement
IntoResponseParts
so([("x-foo", "foo")], response)
now works (#797) -
breaking:
InvalidJsonBody
has been replaced withJsonDataError
to clearly signal that the
request body was syntactically valid JSON but couldn't be deserialized into the target type -
breaking:
Handler
is no longer an#[async_trait]
but instead has an
associatedFuture
type. That allows users to build their ownHandler
types
without paying the cost of#[async_trait]
(#879) -
changed: New
JsonSyntaxError
variant added toJsonRejection
. This is returned when the
request body contains syntactically invalid JSON -
fixed: Correctly set the
Content-Length
header for response toHEAD
requests (#734) -
fixed: Fix wrong
content-length
forHEAD
requests to endpoints that returns chunked
responses (#755) -
fixed: Fixed several routing bugs related to nested "opaque" tower services (i.e.
non-Router
services) (#841 and #842) -
changed: Update to tokio-tungstenite 0.17 (#791)
-
breaking:
Redirect::{to, temporary, permanent}
now accept&str
instead
ofUri
(#889) -
breaking: Remove second type parameter from
Router::into_make_service_with_connect_info
andHandler::into_make_service_with_connect_info
to supportMakeService
s
that accept multiple targets (#892)
axum-macros - v0.2.0
- breaking: Routes are now required to start with
/
. Previously empty routes or routes such
as:foo
would be accepted but most likely result in bugs (#823)
axum-extra - v0.2.0
- added: Add
TypedPath::to_uri
for converting the path into aUri
(#790) - added: Extractors and responses for dealing with cookies. See
extract::cookies
for more
details (#816) - breaking:
CachedRejection
has been removed (#699) - breaking:
<Cached<T> as FromRequest>::Rejection
is nowT::Rejection
. (#699) - breaking:
middleware::from_fn
has been remove from axum-extra and moved into the main
axum crate (#719) - breaking:
HasRoutes
has been removed.Router::merge
now acceptsInto<Router>
(#819) - breaking:
RouterExt::with
method has been removed. UseRouter::merge
instead. It works
identically (#819)