mikeal/request — pull request #951 by kevinoid (2014-07-01 02:07:06+00:00)
Title: Add support for gzip content decoding

My apologies in advance for adding yet another gzip implementation for you to consider, but it appears that work on the alternative solutions (#303, #458, #464, #660) has stalled while interest in a solution is still high (#539, #725, #747) and requires non-trivial effort to implement outside of the library (although it's certainly not horrible).

Unlike the previous solutions, this pull request supports stream-based usage and does not introduce any backwards-incompatible behavior. It is intended to serve as a bridge for the 2.x series until 3.0 is ready for release, at which points its existing gzip implementation can supersede this one.

This commit introduces the `decodeContent` boolean option to allow users to explicitly request decoding of supported response content and inclusion of the appropriate content negotiation header (`Accept-Encoding`), if unspecified.

Although `deflate` support is also common on servers, this commit does not add `deflate` support due to compatibility issues with non-conformant "raw" deflate encodings and the lack of a compelling reason to support it given `gzip`'s wide availability.

Thanks for considering,
Kevin