From d3231cb43651c7d9f457e32708de3c22044c4446 Mon Sep 17 00:00:00 2001 From: zifeitong Date: Tue, 18 Feb 2025 03:29:13 -0800 Subject: [PATCH] [Bugfix] Handle content type with optional parameters (#13383) Signed-off-by: Zifei Tong --- vllm/entrypoints/openai/api_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/entrypoints/openai/api_server.py b/vllm/entrypoints/openai/api_server.py index da5383e790f5..0de7e2392691 100644 --- a/vllm/entrypoints/openai/api_server.py +++ b/vllm/entrypoints/openai/api_server.py @@ -258,7 +258,8 @@ async def build_async_engine_client_from_engine_args( async def validate_json_request(raw_request: Request): content_type = raw_request.headers.get("content-type", "").lower() - if content_type != "application/json": + media_type = content_type.split(";", maxsplit=1)[0] + if media_type != "application/json": raise HTTPException( status_code=HTTPStatus.UNSUPPORTED_MEDIA_TYPE, detail="Unsupported Media Type: Only 'application/json' is allowed"