Skip to content

Commit

Permalink
fix cors
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Oct 30, 2023
1 parent 3b4e9d2 commit 3636578
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fetch/cors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { BunFile } from "bun";

export const BadRequest = toText('Bad Request', 400);
export const NotFound = toText('Not Found', 404);
export const InternalServerError = toText("Internal Server Error", 500);

export const CORS_HEADERS = new Headers({
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
Expand Down Expand Up @@ -35,3 +31,7 @@ export function toFile(body: BunFile, status = 200, headers = new Headers()) {
const fileHeaders = new Headers({"Content-Type": body.type});
return new Response(body, { status, headers: appendHeaders(fileHeaders, headers) });
}

export const BadRequest = toText('Bad Request', 400);
export const NotFound = toText('Not Found', 404);
export const InternalServerError = toText("Internal Server Error", 500);

0 comments on commit 3636578

Please sign in to comment.