axum/examples/customize-extractor-error
2023-09-11 12:12:03 +00:00
..
src Add IntoResponse impl to customize-extractor-error example (#2191) 2023-09-11 12:12:03 +00:00
Cargo.toml
README.md Fix typo on customize-extractor-error example (#2124) 2023-07-27 14:03:10 +00:00

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