Skip to content

Commit

Permalink
chore: changed manifest endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Oct 4, 2024
1 parent 2f06bd6 commit caa4ee3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ export default {
async fetch(request: Request, env: Env): Promise<Response> {
try {
const url = new URL(request.url);
if (url.pathname === "/manifest") {
if (request.method === "GET") {
return new Response(JSON.stringify(manifest), {
headers: { "content-type": "application/json" },
});
} else if (request.method === "POST") {
const webhookPayload = await request.json();
validateAndDecodeSchemas(env, webhookPayload.settings);
return new Response(JSON.stringify({ message: "Schema is valid" }), { status: 200, headers: { "content-type": "application/json" } });
}
if (url.pathname === "/manifest.json" && request.method === "GET") {
return new Response(JSON.stringify(manifest), {
headers: { "content-type": "application/json" },
});
}
if (request.method !== "POST") {
return new Response(JSON.stringify({ error: `Only POST requests are supported.` }), {
Expand Down

0 comments on commit caa4ee3

Please sign in to comment.