Function map_response
fn map_response<F, T>(f: F) -> MapResponseLayer<F, (), T>
Create a middleware from an async function that transforms a response.
This differs from tower::util::MapResponse in that it allows you to easily run axum-specific
extractors.
Example
use ;
async
let app = new
.route
.layer;
# let _: Router = app;
Running extractors
It is also possible to run extractors that implement FromRequestParts. These will be run
before calling the handler.
use ;
use HashMap;
async
let app = new
.route
.layer;
# let _: Router = app;
Note that to access state you must use either map_response_with_state.
Returning any impl IntoResponse
It is also possible to return anything that implements IntoResponse
use ;
use HashMap;
async
let app = new
.route
.layer;
# let _: Router = app;