2

I made a request to a server expecting to get a Json as an answer, but the answer was a compressed gzip and I don't know how to inflate this.

Does someone know a library or a native function to help me with this?

I tried zlib but that needs a stream and my request return a string.

Virthuss
  • 3,142
  • 1
  • 21
  • 39
Z. Clément
  • 474
  • 4
  • 15

2 Answers2

2

In fact with the HTTP package of meteor I just have to make :

requestOption.npmRequestOptions.gzip = true

and the answer is uncompress by the library

Z. Clément
  • 474
  • 4
  • 15
  • It's a bit weird that it doesn't do this by default since the returned header states that it's content-encoding is gzip. Either way, this works. – Casey Gibson May 03 '20 at 00:59
0

You can probably ask the server to respond with JSON by adding the HTTP request header {'Content-Type' : 'application/json'}

HTTP.call('GET', url, {headers: {'Content-Type': 'application/json'}}, asyncCallback)
JeremyK
  • 3,240
  • 1
  • 11
  • 24