Просмотр исходного кода

fix: remove the content-encoding header

akira-cn 2 лет назад
Родитель
Сommit
dd6e79922a
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      app/api/common.ts

+ 2 - 2
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, {