收藏    我在用   0 人在用

gzip Request Serializer for AFNetworking

 GitHub     下载     同步

9    153    35    over 1 year前


AFgzipRequestSerializer applies gzip compression to requests generated by a specified serializer, setting the appropriate Content-Encoding header.

Example Usage

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFgzipRequestSerializer serializerWithSerializer:[AFJSONRequestSerializer serializer]];

[manager POST:@""
   parameters:@{@"foo": @"bar"}
      success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"%@", responseObject);
      failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"[Error] %@", error);


Accept-Content: application/json
Content-Type: application/json
Content-Encoding: gzip

(gzip-compressed JSON)


Mattt Thompson


AFgzipRequestSerializer is available under the MIT license. See the LICENSE file for more info.

No Reply at the moment.
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up