Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#1754 from popcell/fix-immutable-header
Browse files Browse the repository at this point in the history
fix: ChatGPTNextWeb#1746 Can't modify immutable headers.
  • Loading branch information
Yidadaa authored May 25, 2023
2 parents aa74a74 + d533895 commit 9aea6c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export async function requestOpenai(req: NextRequest) {

if (res.status === 401) {
// to prevent browser prompt for credentials
res.headers.delete("www-authenticate");
const newHeaders = new Headers(res.headers);
newHeaders.delete("www-authenticate");
return new Response(res.body, {
status: res.status,
statusText: res.statusText,
headers: newHeaders,
});
}

return res;
Expand Down

0 comments on commit 9aea6c5

Please sign in to comment.