thoughtworks / pacto

Pacto settles disputes between JSON providers and consumers
thoughtworks.github.io/pacto
MIT License
400 stars 58 forks source link

Handle compression #171

Open maxlinc opened 9 years ago

maxlinc commented 9 years ago

Most of the time Pacto seems to be handling compression okay, but I just ran across a test where pacto was proxying a compressed response and responded with a compressed body but without the proper headers. I'm not sure if this was a pacto issue or if the server itself wasn't sending the proper headers.

The workaround was to not forward accept-encoding, but a more proper fix is to make sure the body is decoded as necessary.

Note: This worked, at least for a Gzip stream: Zlib::GzipReader.new(StringIO.new(pacto_response.body))