Question

When trying to execute an http request that causes a 400 Bad Request error, an nginx server returns the "400 Bad Request", a Content-Encoding: gzip, and the response in a non-encoded format.

So because of the Content-Encoding: gzip my code wraps the response with a GZIPInputStream which throws an error.

My question is: is gzip a valid encoding when the status code is not "200 OK"? if not, I can simply check for the status code and not try to gzip if anything other than 200 was returned.

Are there rules/guidelines about this? Is this documented anywhere?

TIA

Was it helpful?

Solution

Yes, it is a valid encoding. Content-Encoding (and Transfer-Encoding) are orthogonal to status codes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top