Skip to content

Commit

Permalink
Conform to the API.
Browse files Browse the repository at this point in the history
  • Loading branch information
dglazkov committed Apr 29, 2024
1 parent ab3b2b4 commit d4f5356
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions seeds/team-experiments/src/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ type Handler = (url: URL, res: ServerResponse) => Promise<boolean>;

export const fromEdgeFunction = (funcImport: unknown): Handler => {
type EdgeFunction = {
default: (request: Request) => Promise<Response>;
GET: (request: Request) => Promise<Response>;
headers: Record<string, string>;
};
const edgeFunction = funcImport as EdgeFunction;
return async (url: URL, res: ServerResponse): Promise<boolean> => {
const request = new Request(url);
const response = await edgeFunction.default(request);
const response = await edgeFunction.GET(request);
res.writeHead(
response.status,
Object.fromEntries(response.headers.entries())
Expand Down

0 comments on commit d4f5356

Please sign in to comment.