Skip to content

Commit

Permalink
thankx chat gpt
Browse files Browse the repository at this point in the history
  • Loading branch information
michelebruno committed Jan 7, 2024
1 parent c2814f5 commit e867d7d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/next/src/revalidateCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ async function handler(request: NextRequest) {
tags: null as string | null,
documentId: null as string | null,
};

const headers = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Origin": "*", // Consenti richieste da tutte le origini
"Access-Control-Allow-Methods": "OPTIONS, POST, GET", // Metodi consentiti
"Access-Control-Allow-Headers": "Content-Type", // Header consentiti
};

const referer = request.headers.get("Referer");
if (referer) {
headers["Access-Control-Allow-Origin"] = referer;
}

if (request.method === "POST") {
const body = await request.json();

Expand All @@ -33,7 +31,7 @@ async function handler(request: NextRequest) {
}

if (request.method === "OPTIONS" || request.method === "HEAD") {
return Response.json(null, { status: 200, headers });
return Response.json(null, { status: 204, headers });
}

if (!data.secret) {
Expand Down

0 comments on commit e867d7d

Please sign in to comment.