If the server supports gzip, it may require the client to request the server for a response with it turned on gzip. To ask the server to use gzip, you will add a specific "Accept-Encoding" header to your requests. You can do this, for example, using these lines of code:
AFHTTPRequestSerializer <AFURLRequestSerialization> *requestSerializer = ...
[requestSerializer setValue:@"gzip, identity" forHTTPHeaderField:@"Accept-Encoding"];
"Accept-Encoding"the header should contain gzip, while perhaps identitynot required.
source
share