问题
I'm using NSURLSession
's dataTaskWithRequest
to download a file. It's gzipped, and it is automatically decompressed. However, I don't want it to be - I want the gzipped source. Is there any way to disable decompression?
回答1:
NSURLSession
automatically inserts this value to your request's header:
"Accept-Encoding: gzip;q=1.0, compress;q=0.5"
which causes the downloaded data to be automatically decoded. So I think you should start by replacing the value of "Accept-Encoding" with something else.
来源:https://stackoverflow.com/questions/41044239/nsurlsession-download-and-do-not-decompress-gzip