Skip to content

fastapi-rust 0.6.0

Latest

Choose a tag to compare

@Dicklesworthstone Dicklesworthstone released this 23 Nov 05:11
· 110 commits to main since this release

Library crate: install from crates.io (fastapi-rust = "0.6.0", with asupersync = { version = "0.7", default-features = false }). All eight fastapi-* crates (fastapi-types, fastapi-macros, fastapi-output, fastapi-router, fastapi-openapi, fastapi-core, fastapi-http, fastapi-rust) are published at 0.6.0. Prebuilt .rlib archives are not attached.

A breaking release moving the async runtime to asupersync 0.7, hardening HTTP/1.1 head admission, request read deadlines, and HTTP/2 prior-knowledge controls, wiring per-App registered exception handlers into macro and fluent routes and extractors, and refreshing dependencies to zero cargo audit vulnerabilities.

Migrating from 0.5.x

  • asupersync 0.5 -> 0.7 (d265d45, e7cb834):
    Depend on asupersync = { version = "0.7", default-features = false } alongside fastapi-rust = "0.6.0". MSRV remains Rust 1.95.
  • IntoResponse for Result<T, E> requires E: 'static (3e87de2) so registered exception handlers can perform exact-type lookup on Err(E) via IntoResponse::into_response_with_context. All built-in error and extractor rejection types are already 'static.

Added and Fixed

  • Per-App exception handlers wired to route errors and extractor rejections (3e87de2):
    App::handle bridges Arc<ExceptionHandlers> into request extensions before middleware execution. Macro routes (#[get], #[post], etc.) and fluent routes (AppBuilder::get/post/..., RouteEntry::new) now dispatch Result<T, E> errors (including type aliases and -> impl IntoResponse) and outer FromRequest::Error rejections to exact-type registered handlers before middleware after() hooks and dependency cleanups run. Unregistered errors retain their IntoResponse fallback, explicit Response values are never reinterpreted, and Option<T> extractors continue to swallow extraction failures as None.
  • HTTP/1.1 head admission, read deadlines, and protocol hardening (c0f054d, 2498d3f, 6d9b4ca, 638b442, 84fb342, 92a9dcd, 3e1f04f):
    • Validate request heads before reading request bodies and gate Expect: 100-continue (ignoring 100-continue on HTTP/1.0).
    • Bound total request-body reads and leading blank lines against the request read deadline, returning 408 Request Timeout on expiry.
    • Answer every refused request cleanly, serve short requests whole, reject non-token HTTP methods, and allow servers to disable HTTP/2 prior-knowledge (h2c) negotiation (ServerConfig::with_http2_prior_knowledge(false)).
    • Extend real-TCP head admission coverage to serve_on_app_concurrent.
  • Installer and scaffolding fixes (d90732a, acd6a49):
    install.sh runs cleanly under stock macOS Bash 3.2 (guarding empty arrays under set -u) and scaffolds fastapi-rust = "0.6.0" with asupersync = { version = "0.7", default-features = false }.

Dependencies, Security, and Build

  • Tokio-free lockfile policy enforced by test (da70f7f):
    Restored the held wasm-bindgen-futures 0.4.78 family and added crates/fastapi/tests/lock_policy.rs so tokio cannot re-enter Cargo.lock.
  • Dependency and security refresh — 0 cargo audit vulnerabilities (08f7251, 0a18547, d265d45, e7cb834):
    Upgraded asupersync to 0.7.0, rich_rust to 0.2.4, parking_lot to 0.13.0, proptest to 1.12.0, ctutils to 0.4.8 (RUSTSEC-2026-0385), pulldown-cmark to 0.13.6 (RUSTSEC-2026-0433, RUSTSEC-2026-0414), rustix to 1.1.6 (RUSTSEC-2026-0486), serde_json to 1.0.154, flate2 to 1.1.11, syn to 3.0.10, regex to 1.13.2, and unicode-width to 0.2.3. See UPGRADE_LOG.md.
  • Workspace release profile configured (acd6a49):
    Explicit opt-level = 3, lto = true, codegen-units = 1, strip = true.