Workers not decoding gzip request automatically
Getting the
.text() of from a logpush job pointing to a worker.text()Z�&�;��2����9s#Ò/y�H�H�����Cp_;05��J#c�E�G9�M*�a�zJ%,�[t���)<�>��Ņ��^����GXLgGC㩡�X��a��-ˍz[/aqR���R�<
�:m��1]��c�>�(�z%��bZ���S�
����
�Oǵ�v�ϰL�ϵq����n���������y= echo '{"mydummy": "json"}' | gzip | curl -v -i --data-binary @- -H "Content-Encoding: gzip" -H "content-type: application/json" http://localhost:8787gzip automatically - you will need to leverage stuff like DecompressionStream echo '{"mydummy": "json"}' | gzip | curl -v -i --data-binary @- -H "Content-Encoding: gzip" -H "content-type: application/json" http://localhost:8787!��c�VʭL)�ͭT�RP�*��S���b
1:53:22 PM POST /json 200gzipDecompressionStreamexport default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
console.log(await request.text())
return new Response("Hello World!");
},
};const ds = new DecompressionStream("gzip");
const tds = new TextDecoderStream();
const chunks = await c.req.body!.pipeThrough(ds).pipeThrough(tds);
let data = "";
for await (let chunk of chunks) {
data = data + chunk;
}
console.log("got text:", data)