Meteor HTTP.GET get gzipped json back how to decompress? -
var url = "https://www.parsehub.com/api/v2/projects/{project_token}/last_ready_run/data"; var api_key = 'te79widrkomn_fxs2e_knnx5'; url = url.replace('{project_token}', 'tbnbvhg208xhgupecak62v80'); console.log('start fetching remote results ' + url); this.unblock(); http.get(url, {params: {api_key: api_key}}, function(error, result) { if(error) { console.log('http failed!'); } else { console.log('http success'); if (result.statuscode === 200) { console.log('status code = 200!'); console.log(result.content); } } });
the result.content here gzipped, how unzip it? tried gb96:zlib not make work. there hidden flag while using http.get automatically unzip gzipped response?
i put issue on meteorpad @ http://meteorpad.com/pad/8lnknnzussnhzbq5s/leaderboard
to reproduce, select player , click "add 5 points".
any appreciated.
thanks,
sorry know late response , question has been open forever, have solution.
in http.get
options can pass npmrequestoptions
object. in object use gzip : true
, response should decompressed you.
something this...
http.get("http://something", { "npmrequestoptions" : {"gzip" : true} }, function(err, res) { //response decompressed! });
Comments
Post a Comment