mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-26 06:14:21 +01:00
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
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -109,9 +109,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.5.16"
|
||||
version = "0.5.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9e3356844c4d6a6d6467b8da2cffb4a2820be256f50a3a386c9d152bab31043"
|
||||
checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
|
@ -141,9 +141,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9f0c0a60006f2a293d82d571f635042a72edf927539b7685bd62d361963839b"
|
||||
checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
|
|
|
@ -14,7 +14,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
# Web framework
|
||||
axum = { version = "0.5.8", default-features = false, features = ["form", "headers", "http1", "http2", "json", "matched-path"], optional = true }
|
||||
axum = { version = "0.5.17", default-features = false, features = ["form", "headers", "http1", "http2", "json", "matched-path"], optional = true }
|
||||
axum-server = { version = "0.4.0", features = ["tls-rustls"] }
|
||||
tower = { version = "0.4.8", features = ["util"] }
|
||||
tower-http = { version = "0.3.4", features = ["add-extension", "cors", "compression-full", "sensitive-headers", "trace", "util"] }
|
||||
|
|
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…
Reference in a new issue