You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Error for requests with gzip content encoding and json content type #31
SyntaxError: Unexpected token ▼ in JSON at position 0
at JSON.parse (<anonymous>)
at /app/index.js:48:22
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
at next (/app/node_modules/express/lib/router/route.js:137:13)
at next (/app/node_modules/express/lib/router/route.js:131:14)
at next (/app/node_modules/express/lib/router/route.js:131:14)
at next (/app/node_modules/express/lib/router/route.js:131:14)
at next (/app/node_modules/express/lib/router/route.js:131:14)
at next (/app/node_modules/express/lib/router/route.js:131:14)
at next (/app/node_modules/express/lib/router/route.js:131:14)
This is a bug in the server, not something that needs to be fixed in the request. Amazon Data Firehose is an example of a well-known application that hits this bug when GZIP encoding is enabled.
Activity
mendhak commentedon Nov 12, 2021
How can I recreate the issue? I tried this:
But everything seems fine.
oleg-babintsev commentedon Nov 12, 2021
I think you need send content in gzip format as binary data, like this:
But I can't check it right now.
mendhak commentedon Nov 15, 2021
I was able to recreate the error/message using
I then tried decompressing the body using
body-parser, which is supposed to be able to work with gzip, but that didn't work.I'll try it a bit more later. I'm looking for a solution that doesn't involve me writing custom code, to avoid complexity.
thieman commentedon Feb 22, 2024
This is a bug in the server, not something that needs to be fixed in the request. Amazon Data Firehose is an example of a well-known application that hits this bug when GZIP encoding is enabled.
basic handling of gzip content-encoding on requests as per mendhak#31 …
mendhak commentedon Mar 22, 2025
This is now available in
mendhak/http-https-echo:36thanks to @matt-mercer for the PR.