Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request ChatGPTNextWeb#3215 from akira-cn/main
Browse files Browse the repository at this point in the history
fix: remove the content-encoding header
  • Loading branch information
Yidadaa authored and H0llyW00dzZ committed Dec 26, 2023
1 parent acc489f commit b6b7584
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export async function requestOpenai(req: NextRequest) {
newHeaders.delete("OpenAI-Organization");
}

// 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
// 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, {
status: res.status,
statusText: res.statusText,
Expand Down

0 comments on commit b6b7584

Please sign in to comment.