Skip to content

Releases: tokio-rs/axum

axum-core - v0.2.1

03 Apr 18:22
Compare
Choose a tag to compare
  • added: Add RequestParts::extract which allows applying an extractor as a method call (#897)

axum - v0.5.0

31 Mar 19:08
Compare
Choose a tag to compare
  • 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 new IntoResponseParts trait so they
    can be returned from handlers as parts of a response (#797)

  • changed: Router::merge now accepts Into<Router> (#819)

  • breaking: sse::Event now accepts types implementing AsRef<str> instead of Into<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 = () on WebSocketStream::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 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.
    • The HeadersAlreadyExtracted variant has been removed from these rejections:
      • RequestAlreadyExtracted
      • RequestPartsAlreadyExtracted
      • JsonRejection
      • FormRejection
      • ContentLengthLimitRejection
      • WebSocketUpgradeRejection
    • <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.
    • 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. Use Extension instead. It now implements
    tower::Layer (#807)

  • breaking: AddExtension has been moved from the root module to middleware

  • 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 with JsonDataError 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
    associated Future type. That allows users to build their own Handler types
    without paying the cost of #[async_trait] (#879)

  • changed: New JsonSyntaxError variant added to JsonRejection. This is returned when the
    request body contains syntactically invalid JSON

  • fixed: Correctly set the Content-Length header for response to HEAD
    requests (#734)

  • fixed: Fix wrong content-length for HEAD 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
    of Uri (#889)

  • breaking: Remove second type parameter from Router::into_make_service_with_connect_info
    and Handler::into_make_service_with_connect_info to support MakeServices
    that accept multiple targets (#892)

axum-macros - v0.2.0

31 Mar 19:08
Compare
Choose a tag to compare
  • 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

31 Mar 19:08
Compare
Choose a tag to compare
  • added: Add TypedPath::to_uri for converting the path into a Uri (#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 now T::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 accepts Into<Router> (#819)
  • breaking: RouterExt::with method has been removed. Use Router::merge instead. It works
    identically (#819)

axum-core - v0.2.0

31 Mar 19:07
fba2faa
Compare
Choose a tag to compare
  • 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.
    • The 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)

axum - v0.4.7

01 Mar 13:01
558a4d0
Compare
Choose a tag to compare
  • added: Implement tower::Layer for Extension (#801)
  • changed: Deprecate AddExtensionLayer. Use Extension instead (#805)

axum-macros - v0.1.2

01 Mar 13:23
Compare
Choose a tag to compare
  • fixed: Use fully qualified Result type (#796)

axum-extra - v0.1.5

01 Mar 13:20
Compare
Choose a tag to compare
  • added: Add TypedPath::to_uri for converting the path into a Uri (#790)

axum - v0.4.6

22 Feb 12:55
4b0b4c8
Compare
Choose a tag to compare
  • added: middleware::from_fn for creating middleware from async functions.
    This previously lived in axum-extra but has been moved to axum (#719)
  • fixed: Set Allow header when responding with 405 Method Not Allowed (#733)

axum-macros - v0.1.1

24 Feb 08:49
Compare
Choose a tag to compare
  • Add #[derive(TypedPath)] for use with axum-extra's new "type safe" routing API (#756)