axum/examples/customize-extractor-error
2024-08-24 08:36:08 +02:00
..
src Use env!("CARGO_CRATE_NAME") in the example to simplify the tracing setup code (#2884) 2024-08-24 08:36:08 +02:00
Cargo.toml
README.md

This example explores 3 different ways you can create custom rejections for already existing extractors

  • with_rejection: Uses axum_extra::extract::WithRejection to transform one rejection into another
  • derive_from_request: Uses the axum::extract::FromRequest derive macro to wrap another extractor and customize the rejection
  • custom_extractor: Manual implementation of FromRequest that wraps another extractor

Run with

cargo run -p example-customize-extractor-error