| 1 | export 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 new Response(JSON.stringify({ |
| 9 | pathname: u.pathname, |
| 10 | search: u.search, |
| 11 | query_foo: u.searchParams.get("foo"), |
| 12 | encoded_len: enc.length, |
| 13 | b64, back: atob(b64), |
| 14 | header: h.get("x-test"), // spec: "1, 2" |
| 15 | protocol: u.protocol, host: u.host, |
| 16 | }), { status: 200 }); |
| 17 | } |
| 18 | }; |