actix-web v4.0.0-beta.2 Release Notes

Release Date: 2021-02-10 // about 3 years ago
  • โž• Added

    • ๐ŸŒ The method Either<web::Json<T>, web::Form<T>>::into_inner() which returns the inner type for whichever variant was created. Also works for Either<web::Form<T>, web::Json<T>>. [#1894]
    • โž• Add services! macro for helping register multiple services to App. [#1933]
    • Enable registering a vec of services of the same type to App [#1933]

    ๐Ÿ”„ Changed

    • ๐Ÿ”€ Rework Responder trait to be sync and returns Response/HttpResponse directly. Making it simpler and more performant. [#1891]
    • ServiceRequest::into_parts and ServiceRequest::from_parts can no longer fail. [#1893]
    • ServiceRequest::from_request can no longer fail. [#1893]
    • Our Either type now uses Left/Right variants (instead of A/B) [#1894]
    • test::{call_service, read_response, read_response_json, send_request} take &Service in argument [#1905]
    • App::wrap_fn, Resource::wrap_fn and Scope::wrap_fn provide &Service in closure argument. [#1905]
    • ๐ŸŒ web::block no longer requires the output is a Result. [#1957]

    ๐Ÿ›  Fixed

    • โœ… Multiple calls to App::data with the same type now keeps the latest call's data. [#1906]

    โœ‚ Removed

    • ๐ŸŒ Public field of web::Path has been made private. [#1894]
    • ๐ŸŒ Public field of web::Query has been made private. [#1894]
    • โœ… TestRequest::with_header; use TestRequest::default().insert_header(). [#1869]
    • AppService::set_service_data; for custom HTTP service factories adding application data, use the layered data model by calling ServiceRequest::add_data_container when handling requests instead. [#1906]

    ๐ŸŒ [#1891]: https://github.com/actix/actix-web/pull/1891 ๐ŸŒ [#1893]: https://github.com/actix/actix-web/pull/1893 ๐ŸŒ [#1894]: https://github.com/actix/actix-web/pull/1894 ๐ŸŒ [#1869]: https://github.com/actix/actix-web/pull/1869 ๐ŸŒ [#1905]: https://github.com/actix/actix-web/pull/1905 ๐ŸŒ [#1906]: https://github.com/actix/actix-web/pull/1906 ๐ŸŒ [#1933]: https://github.com/actix/actix-web/pull/1933 ๐ŸŒ [#1957]: https://github.com/actix/actix-web/pull/1957