Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Nov 1, 2024
1 parent 54a59bd commit a0fb4b8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/taskBouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ const getJson = async <T>(req: http.IncomingMessage): Promise<T> => {
};

const success = (res: http.ServerResponse, output: string | null) => {
res.writeHead(200, { "Content-Type": "application/json" });
res.setHeader("Access-Control-Allow-Origin", "*"); // Allow all domains
res.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE"); // Allowed methods
res.setHeader("Access-Control-Allow-Headers", "Content-Type"); // Allowed headers
res.writeHead(200, {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,POST,PUT,DELETE",
"Access-Control-Allow-Headers": "Content-Type",
});
res.end(output ?? JSON.stringify({ message: "Data received successfully" }));
};

Expand Down

0 comments on commit a0fb4b8

Please sign in to comment.