mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-09 00:00:12 +02:00
Remove B type param: Follow ups (#1789)
Co-authored-by: Jonas Platte <[email protected]> Co-authored-by: Michael Scofield <[email protected]>
This commit is contained in:
co-authored by
Jonas Platte
Michael Scofield
parent
0d50d17304
commit
2ae0cdf7cf
@@ -30,22 +30,21 @@ use tower_layer::Layer;
|
||||
/// Router,
|
||||
/// routing::post,
|
||||
/// body::Body,
|
||||
/// extract::{DefaultBodyLimit, RawBody},
|
||||
/// http::Request,
|
||||
/// extract::{Request, DefaultBodyLimit},
|
||||
/// };
|
||||
///
|
||||
/// let app = Router::new()
|
||||
/// .route(
|
||||
/// "/",
|
||||
/// // even with `DefaultBodyLimit` the request body is still just `Body`
|
||||
/// post(|request: Request<Body>| async {}),
|
||||
/// post(|request: Request| async {}),
|
||||
/// )
|
||||
/// .layer(DefaultBodyLimit::max(1024));
|
||||
/// # let _: Router = app;
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// use axum::{Router, routing::post, body::Body, extract::RawBody, http::Request};
|
||||
/// use axum::{Router, routing::post, body::Body, extract::Request};
|
||||
/// use tower_http::limit::RequestBodyLimitLayer;
|
||||
/// use http_body::Limited;
|
||||
///
|
||||
@@ -54,7 +53,7 @@ use tower_layer::Layer;
|
||||
/// "/",
|
||||
/// // `RequestBodyLimitLayer` changes the request body type to `Limited<Body>`
|
||||
/// // extracting a different body type wont work
|
||||
/// post(|request: Request<Body>| async {}),
|
||||
/// post(|request: Request| async {}),
|
||||
/// )
|
||||
/// .layer(RequestBodyLimitLayer::new(1024));
|
||||
/// # let _: Router = app;
|
||||
|
||||
Reference in New Issue
Block a user