Skip to content

Commit

Permalink
reordered constants
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienR1 committed Oct 31, 2023
1 parent 22d7d0f commit 5eb5807
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 All @@ -12,6 +8,10 @@ export const CORS_HEADERS = new Headers({
export const JSON_HEADERS = new Headers({ "Content-Type": "application/json" });
export const TEXT_HEADERS = new Headers({ "Content-Type": "text/plain" });

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

export function appendHeaders(...args: Headers[]) {
const headers = new Headers(CORS_HEADERS); // CORS as default headers
for (const arg of args) {
Expand Down

0 comments on commit 5eb5807

Please sign in to comment.