axum/examples/customize-extractor-error
David Pedersen 6703f8634c Remove B type param: Follow ups (#1789)
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Michael Scofield <mscofield0@tutanota.com>
2023-04-21 17:45:31 +02:00
..
src Remove B type param: Follow ups (#1789) 2023-04-21 17:45:31 +02:00
Cargo.toml Extend custom rejection examples (#1276) 2022-08-19 13:11:03 +00:00
README.md Re-integrate examples into the root workspace (#1466) 2023-03-10 12:02:11 +01: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 axum_macros::FromRequest 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