#extractor #axum #body #split #from-request #split-body

axum-body-split

A library to use multiple FromRequest extractors in axum

1 unstable release

Uses new Rust 2024

0.1.0 Mar 13, 2025

#12 in #body

Download history 132/week @ 2025-03-12

132 downloads per month

MIT/Apache

7KB
55 lines

Axum Body Split

Tiny library to fix my annoyance with axum, where I sometimes just want a quick and dirty way to use an extractor implementing FromRequest twice.

Usage

Usage is like of any other extractor, but you need to add your state type as a type parameter (because FromRequest has access to the state, so it needs to know what type it is)

Example without state:

SplitBody(Json(json), text, _): SplitBody<Json<RequestJson>, String, ()>

Example with state:

SplitBody(Json(json), text, _): SplitBody<Json<RequestJson>, String, AppState>

Examples

check out examples for examples of how to use this

Dependencies

~5–11MB
~111K SLoC