All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
#[must_use]
attributes to types that do nothing unless used (#1809)IntoResponse
for &'static [u8; N]
and [u8; N]
(#1690)body_text
and status
methods to built-in rejections (#1612)FromRequestParts
trait. See axum's changelog for more details (#1272)FromRequest
has been reworked and RequestParts
has been removed. See axum's changelog for more details (#1272)BodyAlreadyExtracted
has been removed (#1272)AppendHeaders
now works on any impl IntoIterator
(#1495)DefaultBodyLimit::max
for changing the default body limit (#1397)Error::into_inner
for converting Error
to BoxError
without allocating (#1476)AppendHeaders
now works on any impl IntoIterator
(#1495)breaking: Added default limit to how much data Bytes::from_request
will consume. Previously it would attempt to consume the entire request body without checking its length. This meant if a malicious peer sent an large (or infinite) request body your server might run out of memory and crash.
The default limit is at 2 MB and can be disabled by adding the new DefaultBodyLimit::disable()
middleware. See its documentation for more details.
This also applies to String
which used Bytes::from_request
internally.
(#1346)
FromRequest
has been reworked and RequestParts
has been removed. See axum's changelog for more details (#1272)FromRequestParts
trait. See axum's changelog for more details (#1272)BodyAlreadyExtracted
has been removed (#1272)breaking: Added default limit to how much data Bytes::from_request
will consume. Previously it would attempt to consume the entire request body without checking its length. This meant if a malicious peer sent an large (or infinite) request body your server might run out of memory and crash.
The default limit is at 2 MB and can be disabled by adding the new DefaultBodyLimit::disable()
middleware. See its documentation for more details.
This also applies to String
which used Bytes::from_request
internally.
(#1346)
RequestParts
docs (#1147)http_body::LengthLimitError
in FailedToBufferBody
and map such errors to 413 Payload Too Large
(#1048)impl IntoResponse
less in docs (#1049)IntoResponse
and IntoResponseParts
for http::Extensions
(#975)IntoResponse
for (http::response::Parts, impl IntoResponse)
(#950)IntoResponse
for (http::response::Response<()>, impl IntoResponse)
(#950)IntoResponse for (Parts | Request<()>, $(impl IntoResponseParts)+, impl IntoResponse)
(#980)response::ErrorResponse
and response::Result
for IntoResponse
-based error handling (#921)AppendHeaders
for appending headers to a response rather than overriding them (#927)RequestParts::extract
which allows applying an extractor as a method call (#897)added: Add IntoResponseParts
trait which allows defining custom response types for adding headers or extensions to responses (#797)
breaking: Using HeaderMap
as an extractor will no longer remove the headers and thus they'll still be accessible to other extractors, such as axum::extract::Json
. Instead HeaderMap
will clone the headers. You should prefer to use TypedHeader
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.HeadersAlreadyExtracted
variant has been removed from these rejections:RequestAlreadyExtracted
RequestPartsAlreadyExtracted
<HeaderMap as FromRequest<_>>::Rejection
has been changed to std::convert::Infallible
.breaking: axum::http::Extensions
is no longer an extractor (ie it doesn't implement FromRequest
). The axum::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 now BodyAlreadyExtracted
.<http::request::Parts as FromRequest>::Rejection
is now Infallible
.ExtensionsAlreadyExtracted
has been removed.breaking: RequestParts::body_mut
now returns &mut Option<B>
so the body can be swapped (#869)
IntoResponse
for bytes::BytesMut
and bytes::Chain<T, U>
(#767)axum_core::response::Response
now exists as a shorthand for writing Response<BoxBody>
(#590)