spire-io/shred — Issue #10: gzip support
Author: nlacasse
Created: 2011-12-16 00:50:09+00:00
State: open

If a response comes back with "Content-Encoding: gzip", then the body of the response should be gunzipped.

This will require node 0.6 and the following library:
https://github.com/devdazed/gzip-buffer

In response.js lines 26-32 we set the body of the response by calling "new Content" and passing in the Content-Type. We should also pass in the "Content-Encoding".

Inside content.js, we need to check the content-encoding, and do the gunzipping if it is "gzip".

You can make a request that asks for gzip content like this:
shred.get({
url: "http://api.spire.com",
headers: {
accept: "application/json",
"Accept-Encoding": "gzip"
},
on: {
response: function (d) { console.log(d) }
}
});

Right now that request logs a bunch of gzipped garbage. Once this ticket is fixed, that should log text.

We should make a test for this too.