Skip to content

Commit

Permalink
feat(http): add multipart for server
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarisW committed Oct 25, 2024
1 parent c56beae commit 6721517
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion volo-http/src/server/layer/body_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ impl BodyLimitLayer {
/// Create a new [`BodyLimitLayer`] with given `body_limit`.
///
/// If the Body is larger than the `body_limit`, the request will be rejected.
/// ```
pub fn new(body_limit: usize) -> Self {
Self { limit: body_limit }
}
Expand Down
12 changes: 7 additions & 5 deletions volo-http/src/server/utils/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,22 @@ use crate::{
/// ```rust
/// use http::StatusCode;
/// use volo_http::{
/// Router,
/// server::{
/// layer::BodyLimitLayer,
/// route::post,
/// utils::multipart::{Multipart, MultipartRejectionError},
/// }
/// },
/// Router,
/// };
///
/// async fn upload_handler(mut multipart: Multipart) -> Result<StatusCode, MultipartRejectionError> {
/// async fn upload_handler(
/// mut multipart: Multipart,
/// ) -> Result<StatusCode, MultipartRejectionError> {
/// Ok(StatusCode::OK)
/// }
///
/// let app: Router<_>= Router::new()
/// .route("/",post(upload_handler))
/// let app: Router<_> = Router::new()
/// .route("/", post(upload_handler))
/// .layer(BodyLimitLayer::new(1024));
/// ```
#[must_use]
Expand Down

0 comments on commit 6721517

Please sign in to comment.