From c0f31a3bc0dab74f9354453872c0f4e5588653d6 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Thu, 20 Aug 2026 03:36:34 +0100 Subject: [PATCH] fix(openai): case-insensitive content-type gate Content-Type header values are case-insensitive per RFC 7231, but chatCompletion's streaming-vs-JSON-fallback gate used a plain strings.Contains against "text/event-stream", so an upstream that sent "Text/Event-Stream" or similar would silently fall through to the non-streaming passthrough path. Carried item (a) from Task 9's brief. --- provider_openai.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provider_openai.go b/provider_openai.go index 106126f..0b9fb07 100644 --- a/provider_openai.go +++ b/provider_openai.go @@ -121,7 +121,7 @@ func (a *openaiAdapter) chatCompletion(ctx context.Context, w http.ResponseWrite return usage{}, newProviderHTTPError(resp) } - if streaming && strings.Contains(resp.Header.Get("Content-Type"), "text/event-stream") { + if streaming && strings.Contains(strings.ToLower(resp.Header.Get("Content-Type")), "text/event-stream") { return a.forwardStream(w, resp.Body, clientAskedUsage) } // Either a non-streaming request, or a streaming one whose upstream