From dd6e79922a455862d6ae5c0a9469680d5c9e1d90 Mon Sep 17 00:00:00 2001 From: akira-cn Date: Fri, 10 Nov 2023 20:42:12 +0800 Subject: [PATCH] fix: remove the content-encoding header --- app/api/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index e95bb483..9f786c40 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -108,8 +108,8 @@ export async function requestOpenai(req: NextRequest) { // The latest version of the OpenAI API forced the content-encoding to be "br" in json response // So if the streaming is disabled, we need to remove the content-encoding header - // But vercel uses gzip to compress the response - // So we need to remove the content-encoding header + // Because Vercel uses gzip to compress the response, if we don't remove the content-encoding header + // The browser will try to decode the response with brotli and fail newHeaders.delete("content-encoding"); return new Response(res.body, {