Skip to content

Commit

Permalink
Do it
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-tom committed Aug 20, 2024
1 parent 665509f commit 4c01d67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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)]
Expand Down Expand Up @@ -315,6 +318,7 @@ where
)))
.route("/health", get(get_health_readiness::<C>)) // health checks are not authenticated
.with_state(state)
.layer(DefaultBodyLimit::max(100 * MB))
.layer(
TraceLayer::new_for_http()
.make_span_with(make_span)
Expand Down

0 comments on commit 4c01d67

Please sign in to comment.