I am sending data in the body of a HTTP request to a Restify instance with a content-encoding of gzip. Only problem is I am unable to access the body with the gzipped data in it.
Here is my JS code that I am using to determine it, but req.body comes out as undefined:
server.use(function(req, res, next) {
if(req.headers['content-encoding'] == 'gzip')
{
console.log(req);
// We have a gzipped body here
var zlib = require("zlib");
var gunzip = zlib.createGunzip();
console.log("Body: "+ req.body)
console.log("Length: " + req.body.length);
}
else
{
apiKey = req.query['apiKey'];
authenticateAndRoute(apiKey, req, res, next)
}
})
Anybody have a clue on how to access req.body here or an equivalent?