diff --git a/crates/sdk/src/default_main.rs b/crates/sdk/src/default_main.rs index c5277e2..3445309 100644 --- a/crates/sdk/src/default_main.rs +++ b/crates/sdk/src/default_main.rs @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf}; use axum::{ body::Body, - extract::State, + extract::{DefaultBodyLimit, State}, http::{HeaderValue, Request, StatusCode}, response::IntoResponse as _, routing::{get, post}, @@ -26,6 +26,9 @@ use crate::json_rejection::JsonRejection; use crate::json_response::JsonResponse; use crate::tracing::{init_tracing, make_span, on_response}; +// To add a limit to request sizes. +const MB: usize = 1_048_576; + #[derive(Parser)] struct CliArgs { #[command(subcommand)] @@ -315,6 +318,7 @@ where ))) .route("/health", get(get_health_readiness::)) // health checks are not authenticated .with_state(state) + .layer(DefaultBodyLimit::max(100 * MB)) .layer( TraceLayer::new_for_http() .make_span_with(make_span)