Skip to content

Commit

Permalink
Added headers for leech response
Browse files Browse the repository at this point in the history
  • Loading branch information
cultpodcasts committed Mar 29, 2024
1 parent 0e303bb commit 08365f1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ export default {

let body: any = await response.json();
body["@odata.context"] = null;
let bodyJson = JSON.stringify(body);

return new Response(bodyJson, { headers })
return new Response(JSON.stringify(body), { headers })
});
} else {
const leechResponse = {
Expand All @@ -173,9 +171,15 @@ export default {
"subjects": []
}]
};
const headers = new Headers();
headers.set("Cache-Control", "max-age=600");
headers.append("Content-Type", "application/json");
headers.append("Access-Control-Allow-Origin", "*");
headers.append("Access-Control-Allow-Methods", "POST,GET,OPTIONS");

dataPoint.blobs!.push("Leech");
env.Analytics.writeDataPoint(dataPoint);
var response = new Response(JSON.stringify(leechResponse));
var response = new Response(JSON.stringify(leechResponse), { headers });
return response;
}
}
Expand Down

0 comments on commit 08365f1

Please sign in to comment.