AFNetworking / AFgzipRequestSerializer

gzip Request Serializer for AFNetworking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The body of multipart/form-data request is not compressed

Anislav opened this issue · comments

For example the request generated by the following code:

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

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

looks like:

    POST http://example.com/

    Content-Type: multipart/form-data; boundary=Boundary+42080181961C804E
    Content-Length: 111

    --Boundary+42080181961C804E
    Content-Disposition: form-data; name="foo"

    bar
    --Boundary+42080181961C804E--