const ac=new AbortController();
const srv=Deno.serve({port:8123,signal:ac.signal,onListen(){}},async(req)=>{
  const h:Record<string,string>={}; req.headers.forEach((v,k)=>h[k]=v);
  const b=new Uint8Array(await req.arrayBuffer());
  return new Response(JSON.stringify({headers:h,actualBodyLen:b.length}));
});
await new Promise(r=>setTimeout(r,300));
// A) current index.ts style: no body, manual Content-Length: 0, Content-Type: application/json
const r1=await fetch("http://localhost:8123/",{method:"POST",headers:{"Content-Type":"application/json","Content-Length":"0","TTL":"86400","Authorization":"vapid t=x, k=y"}});
console.log("A (current code style):", JSON.stringify(await r1.json(),null,1));
// B) correct aes128gcm style with body + a bogus manual Content-Length
const r2=await fetch("http://localhost:8123/",{method:"POST",headers:{"Content-Type":"application/octet-stream","Content-Encoding":"aes128gcm","Content-Length":"999","TTL":"86400"},body:new Uint8Array(120)});
console.log("B (aes128gcm style, bogus CL=999):", JSON.stringify(await r2.json(),null,1));
ac.abort(); await srv.finished.catch(()=>{});
