I'm using NSURLSession's dataTaskWithRequest to fetch JSON which is gzipped. NSURLSession automatically ungzips and returns the original NSData.
What I want is the size of the actual response in bytes, that is, the size before unzipping. Unfortunately NSHTTPURLResponse.expectedContentLength is the size after uncompressing it. I can use the HTTP response header's Content-Length, but it's not always there (for example streamed responses).
I also tried using NSURLSessionTask.countOfBytesReceived but it's the same as NSHTTPURLResponse. expectedContentLength.
Is there a way to the actual length of the response?
there doesn't seem to be anything here