Open oleg-babintsev opened 2 years ago
How can I recreate the issue? I tried this:
curl -X POST -H "Content-Type: application/json" -d '{"a":"b"}' -H "Charset: utf-8" -H "Content-Encoding: gzip" http://localhost:8080/test/abc
But everything seems fine.
I think you need send content in gzip format as binary data, like this:
echo '{ "mydummy" : "json" }' | gzip > body.gz
curl -v -i http://localhost/mymodule -H'Content-Encoding: gzip' --data-binary @body.gz
But I can't check it right now.
I was able to recreate the error/message using
echo '{ "mydummy" : "json" }' | gzip > body.gz
curl -v -i http://localhost:8080/mymodule -H 'Content-Encoding: gzip' -H 'Content-Type: application/json' --data-binary @body.gz
I then tried decompressing the body using body-parser
, which is supposed to be able to work with gzip, but that didn't work.
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
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.
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.
Request headers:
Output in console: