Skip to content

Commit

Permalink
Merge pull request #32 from RuochenLyu/patch-1
Browse files Browse the repository at this point in the history
fix CORS policy blocked
  • Loading branch information
haibbo authored May 19, 2023
2 parents 8586fc6 + ecf68b3 commit ee504b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cf-openai-azure-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ async function handleRequest(request) {
body: typeof body === 'object' ? JSON.stringify(body) : '{}',
};

const response = await fetch(fetchAPI, payload);
let response = await fetch(fetchAPI, payload);
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");

if (body?.stream != true){
return response
Expand Down

0 comments on commit ee504b9

Please sign in to comment.