fix(main): fix request size limit to max_request_size (axum defaults 2MB)
This commit is contained in:
parent
cb2b5beea8
commit
10d2da3009
3 changed files with 13 additions and 7 deletions
10
src/main.rs
10
src/main.rs
|
@ -10,7 +10,7 @@
|
|||
use std::{future::Future, io, net::SocketAddr, time::Duration};
|
||||
|
||||
use axum::{
|
||||
extract::{FromRequest, MatchedPath},
|
||||
extract::{DefaultBodyLimit, FromRequest, MatchedPath},
|
||||
handler::Handler,
|
||||
response::IntoResponse,
|
||||
routing::{get, on, MethodFilter},
|
||||
|
@ -164,7 +164,13 @@ async fn run_server() -> io::Result<()> {
|
|||
header::AUTHORIZATION,
|
||||
])
|
||||
.max_age(Duration::from_secs(86400)),
|
||||
);
|
||||
)
|
||||
.layer(DefaultBodyLimit::max(
|
||||
config
|
||||
.max_request_size
|
||||
.try_into()
|
||||
.expect("failed to convert max request size"),
|
||||
));
|
||||
|
||||
let app = routes().layer(middlewares).into_make_service();
|
||||
let handle = ServerHandle::new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue