| 1 | import type { AsyncWorkerEnv } from "./stack.ts"; |
| 2 | |
| 3 | export default { |
| 4 | async fetch(request: Request, env: AsyncWorkerEnv): Promise<Response> { |
| 5 | const url = new URL(request.url); |
| 6 | if (url.pathname === "/send") { |
| 7 | await env.EVENTS.send([ |
| 8 | { |
| 9 | source: "pipelines-binding-test", |
| 10 | nonce: url.searchParams.get("nonce") ?? "none", |
| 11 | }, |
| 12 | ]); |
| 13 | return Response.json({ |
| 14 | mode: "async", |
| 15 | sent: true, |
| 16 | kind: typeof env.EVENTS.send, |
| 17 | }); |
| 18 | } |
| 19 | return Response.json({ |
| 20 | mode: "async", |
| 21 | sent: false, |
| 22 | kind: typeof env.EVENTS.send, |
| 23 | }); |
| 24 | }, |
| 25 | }; |