Skip to content

Commit

Permalink
fix: remove the content-encoding header
Browse files Browse the repository at this point in the history
  • Loading branch information
akira-cn authored and lovely committed Feb 1, 2024
1 parent 781d675 commit 34cd724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,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, {
Expand Down

0 comments on commit 34cd724

Please sign in to comment.