Skip to content

Commit

Permalink
feat: increase max request body size to 10MB
Browse files Browse the repository at this point in the history
Torrent files containing a lot of files (for example datasets) are big. In the future, this
should be a config option.
  • Loading branch information
josecelano committed Aug 21, 2023
1 parent 4d6ab95 commit 35a5430
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/web/api/v1/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::env;
use std::sync::Arc;

use axum::extract::DefaultBodyLimit;
use axum::routing::get;
use axum::Router;
use tower_http::cors::CorsLayer;
Expand Down Expand Up @@ -35,9 +36,11 @@ pub fn router(app_data: Arc<AppData>) -> Router {
.route("/", get(about_page_handler).with_state(app_data))
.nest(&format!("/{API_VERSION_URL_PREFIX}"), v1_api_routes);

if env::var(ENV_VAR_CORS_PERMISSIVE).is_ok() {
let router = if env::var(ENV_VAR_CORS_PERMISSIVE).is_ok() {
router.layer(CorsLayer::permissive())
} else {
router
}
};

router.layer(DefaultBodyLimit::max(10_485_760))
}

0 comments on commit 35a5430

Please sign in to comment.