Sometimes, the metadata endpoints are returning weird, corrupt data.
Response: http://i.imgur.com/dgsI1KX.png
Not sure why this is happening, none of the response headers are saying anything is wrong.
Sometimes, the metadata endpoints are returning weird, corrupt data.
Response: http://i.imgur.com/dgsI1KX.png
Not sure why this is happening, none of the response headers are saying anything is wrong.
It’s encoded/compressed.
Check the response headers (Content-Encoding) and you’ll see what compression is used.
> HTTP/1.1 200 OK
> …
> Content-Type: application/json; charset=utf-8
> Content-Encoding: gzip
> …
You can enable automatic decompression on a HttpClientHandler:
> …
> var handler = new HttpClientHandler
> {
> AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
> };
> _httpClient = new HttpClient(handler);
> _httpClient.DefaultRequestHeaders.Add(HeaderName, product.SubscriptionKey);
> …
Strange, I’ve handled gzip’d responses before, and they’ve - before now - always been decrypted automatically. Thanks for the heads up though!
I also didn’t realise until I looked at the headers. Would be nice if the documentation noted it haha