Upgrading axum 0.6 to 0.7
Breaking0.6.20 → 0.7.9Breaking21Platform1New24Changed5Fixed11
BreakingUpgrade verdict
21 breaking changes and a platform requirement change.
In plain terms
- 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.
Must act Top 4 of 22 that need code or config changes
Rust requirement changed in 0.7.0: 1.63 → 1.66.
What you must change
Breaking21
fixed: h2 is no longer pulled as a dependency unless the http2 feature is enabled ().
h2http2breaking: Remove deprecated WebSocketUpgrade::max_send_queue.
WebSocketUpgrade::max_send_queuebreaking: The following types/traits are no longer generic over the request body (i.e. the B type param has been removed) ( and ).
BFromRequestPartsFromRequestHandlerServiceHandlerWithoutStateExtHandlerbreaking: axum no longer re-exports hyper::Body as that type is removed in hyper 1.0.
hyper::Bodyaxum::body::Bodybreaking: extract::BodyStream has been removed as body::Body implements Stream and FromRequest directly ().
extract::BodyStreambody::BodyStreamFromRequestbreaking: Rename DefaultOnFailedUpdgrade to DefaultOnFailedUpgrade ().
DefaultOnFailedUpdgradeDefaultOnFailedUpgradebreaking: Rename OnFailedUpdgrade to OnFailedUpgrade ().
OnFailedUpdgradeOnFailedUpgradebreaking: Removed re-exports of Empty and Full.
EmptyFullaxum::body::Body::emptyaxum::body::Body::frombreaking: Removed the BoxBody type alias and its box_body constructor.
BoxBodybox_bodyaxum::body::Body::newbreaking: Remove RawBody extractor. axum::body::Body implements FromRequest directly ().
RawBodyaxum::body::BodyFromRequestbreaking: The following types from http-body no longer implement IntoResponse.
http-bodyIntoResponseFullBody::fromEmptyBody::emptybreaking: 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_databreaking: 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::Errorbreaking: TypedHeader has been move to axum-extra ().
TypedHeaderaxum-extrabreaking: 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::Responsebreaking: Only inherit fallbacks for routers nested with Router::nest.
Router::nestRouter::nest_servicebreaking: Simplify MethodFilter.
MethodFilterbreaking: 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 ().