Diffinery

homeflare/celldpublic

20 lines · 523 BRaw History
1export default {
2 async fetch(request, env) {
3 const u = new URL(request.url);
4 const enc = new TextEncoder().encode("cells");
5 const b64 = btoa("hello");
6 const h = new Headers({ "x-test": "1" });
7 h.append("x-test", "2");
8 return Response.json({
9 pathname: u.pathname,
10 search: u.search,
11 query_foo: u.searchParams.get("foo"),
12 encoded_len: enc.length,
13 b64,
14 back: atob(b64),
15 header: h.get("x-test"),
16 protocol: u.protocol,
17 host: u.host,
18 });
19 },
20};