Skip to content

Commit 2c7a6a7

Browse files
committed
feat: remove CORS Headers from devrel-tracker.ts and types.ts
1 parent ae87f15 commit 2c7a6a7

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

functions/tracker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { Env, Context, CustomRequest, corsHeaders } from "./types";
1+
import { Env, Context, CustomRequest } from "./types";
22
import { validatePOST } from "./validators";
33

4+
export const corsHeaders = {
5+
"Access-Control-Allow-Origin": "*",
6+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
7+
"Access-Control-Allow-Headers": "Content-Type",
8+
};
9+
410
export async function onRequest(ctx: Context): Promise<Response> {
511
const { request, env } = ctx;
612

functions/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { EventContext, KVNamespace } from "@cloudflare/workers-types";
22
import { Request, IncomingRequestCfProperties } from "@cloudflare/workers-types";
33

4-
export const corsHeaders = {
5-
"Access-Control-Allow-Origin": "*",
6-
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
7-
"Access-Control-Allow-Headers": "Content-Type",
8-
};
9-
104
export interface Env {
115
userToReferral: KVNamespace;
126
}

src/home/devrel-tracker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getGitHubAccessToken } from "./getters/get-github-access-token";
2-
import { corsHeaders } from "../../functions/types";
32

43
declare const WORKER_URL: string; // @DEV: passed in at build time check build/esbuild-build.ts
54

@@ -26,7 +25,6 @@ export async function trackDevRelReferral(devGitHubId: number) {
2625
const response = await fetch(url, {
2726
method: "POST",
2827
headers: {
29-
...corsHeaders,
3028
"Content-Type": "application/json",
3129
},
3230
body: JSON.stringify(accessToken),

0 commit comments

Comments
 (0)