[router] Raise chat body cap to 5 MiB for long contexts (#28742)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kangyan-Zhou
2026-06-19 15:50:34 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 420004827c
commit abf7011cdd
3 changed files with 19 additions and 16 deletions
@@ -10,6 +10,7 @@ use sgl_router::policies::factory::build_registry_with_defaults as build_policy_
use sgl_router::proxy::Proxy;
use sgl_router::server::app::build_router;
use sgl_router::server::app_context::AppContext;
use sgl_router::server::routes::chat::MAX_CHAT_BODY_BYTES;
use sgl_router::tokenizer::TokenizerRegistry;
use sgl_router::workers::{Worker, WorkerRegistry};
@@ -514,8 +515,9 @@ async fn oversized_request_body_returns_413() {
let ctx = build_ctx_with_worker(&worker.url);
let app = build_router(ctx);
// 2 MiB body — the configured limit is 1 MiB.
let big = vec![b'x'; 2 * 1024 * 1024];
// One byte over the configured cap, so the test tracks the cap
// (`MAX_CHAT_BODY_BYTES`) instead of a hardcoded size.
let big = vec![b'x'; MAX_CHAT_BODY_BYTES + 1];
let req = Request::builder()
.method("POST")
.uri("/v1/chat/completions")