Skip to content

Upgrading axum 0.6 to 0.7

Breaking0.6.20 → 0.7.9Breaking21Platform1New24Changed5Fixed11

BreakingUpgrade verdict

21 breaking changes and a platform requirement change.

  • fixed: h2 is no longer pulled as a dependency unless the http2 feature is enabled ().
  • breaking: Remove deprecated WebSocketUpgrade::max_send_queue.
  • breaking: The following types/traits are no longer generic over the request body (i.e. the B type param has been removed) ( and ).
  • breaking: axum no longer re-exports hyper::Body as that type is removed in hyper 1.0.
Top 4 of 22 that need code or config changes

Rust requirement changed in 0.7.0: 1.63 → 1.66.

Breaking21
fixed: h2 is no longer pulled as a dependency unless the http2 feature is enabled ().
h2http2
breaking: Remove deprecated WebSocketUpgrade::max_send_queue.
WebSocketUpgrade::max_send_queue
breaking: The following types/traits are no longer generic over the request body (i.e. the B type param has been removed) ( and ).
BFromRequestPartsFromRequestHandlerServiceHandlerWithoutStateExtHandler
breaking: axum no longer re-exports hyper::Body as that type is removed in hyper 1.0.
hyper::Bodyaxum::body::Body
breaking: extract::BodyStream has been removed as body::Body implements Stream and FromRequest directly ().
extract::BodyStreambody::BodyStreamFromRequest
breaking: Rename DefaultOnFailedUpdgrade to DefaultOnFailedUpgrade ().
DefaultOnFailedUpdgradeDefaultOnFailedUpgrade
breaking: Rename OnFailedUpdgrade to OnFailedUpgrade ().
OnFailedUpdgradeOnFailedUpgrade
breaking: Removed re-exports of Empty and Full.
EmptyFullaxum::body::Body::emptyaxum::body::Body::from
breaking: Removed the BoxBody type alias and its box_body constructor.
BoxBodybox_bodyaxum::body::Body::new
breaking: Remove RawBody extractor. axum::body::Body implements FromRequest directly ().
RawBodyaxum::body::BodyFromRequest
breaking: The following types from http-body no longer implement IntoResponse.
http-bodyIntoResponseFullBody::fromEmptyBody::empty
breaking: Removed axum::Server as it was removed in hyper 1.0.
axum::Serveraxum::serve(listener, service)
fixed: Skip SSE incompatible chars of serde_json::RawValue in Event::json_data ().
serde_json::RawValueEvent::json_data
breaking: Update public dependencies. axum now requires.
breaking: axum now requires tower-http 0.5.
breaking: Change sse::Event::json_data to use axum_core::Error as its error type ().
sse::Event::json_dataaxum_core::Error
breaking: TypedHeader has been move to axum-extra ().
TypedHeaderaxum-extra
breaking: The response returned by IntoResponse::into_response must use axum::body::Body as the body type. axum::response::Response does this ().
IntoResponse::into_responseaxum::body::Bodyaxum::response::Response
breaking: Only inherit fallbacks for routers nested with Router::nest.
Router::nestRouter::nest_service
breaking: Simplify MethodFilter.
MethodFilter
breaking: impl IntoResponse(Parts) for Extension now requires T: Clone, as that is required by the http crate ().
Platform1
change: axum's MSRV is now 1.66 ().