Skip to content

Commit 53bdb38

Browse files
fix: disable default body limit for upload profile
Axum's Bytes extractor has a 2MB default body limit, but the upload benchmark sends 20MB bodies — causing 100% 4xx (413 Payload Too Large). Add DefaultBodyLimit::disable() to allow unlimited request bodies.
1 parent 3018a71 commit 53bdb38

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

frameworks/axum/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use axum::{
2-
extract::{Path, State},
2+
extract::{DefaultBodyLimit, Path, State},
33
http::{header, HeaderValue, StatusCode},
44
response::{IntoResponse, Response},
55
routing::{get, post},
@@ -423,6 +423,7 @@ async fn main() {
423423
.route("/db", get(db_endpoint))
424424
.route("/upload", post(upload))
425425
.route("/static/{filename}", get(static_file))
426+
.layer(DefaultBodyLimit::disable())
426427
.layer(CompressionLayer::new())
427428
.with_state(state.clone());
428429

0 commit comments

Comments
 (0)