{"action":"created","issue":{"url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1398","labels_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1398/labels{/name}","comments_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1398/comments","events_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1398/events","html_url":"https://github.com/AFNetworking/AFNetworking/issues/1398","id":20281917,"number":1398,"title":"POST method does not send Content-Length","user":{"login":"robertvojta","id":1084172,"avatar_url":"https://avatars.githubusercontent.com/u/1084172?v=3","gravatar_id":"","url":"https://api.github.com/users/robertvojta","html_url":"https://github.com/robertvojta","followers_url":"https://api.github.com/users/robertvojta/followers","following_url":"https://api.github.com/users/robertvojta/following{/other_user}","gists_url":"https://api.github.com/users/robertvojta/gists{/gist_id}","starred_url":"https://api.github.com/users/robertvojta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertvojta/subscriptions","organizations_url":"https://api.github.com/users/robertvojta/orgs","repos_url":"https://api.github.com/users/robertvojta/repos","events_url":"https://api.github.com/users/robertvojta/events{/privacy}","received_events_url":"https://api.github.com/users/robertvojta/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":56,"created_at":"2013-09-30T18:35:23Z","updated_at":"2015-01-07T02:23:28Z","closed_at":"2014-02-11T20:12:39Z","body":"I tried to upload some small chunk of data to Amazon S3 with this request:\r\n\r\n```\r\n- (void)uploadUserAvatarImae:(NSData *)image\r\n                         url:(NSURL *)url\r\n                      params:(NSDictionary *)params\r\n                     success:(void(^)(void))success\r\n                     failure:(void(^)(NSError *error))failure {\r\n  __block AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:url];\r\n  [sessionManager POST:@\"\"\r\n            parameters:params\r\n                                            constructingBodyWithBlock:^(id < AFMultipartFormData > formData) {\r\n                                              [formData appendPartWithFormData:image name:@\"file\"];\r\n                                            }\r\n                                            success:^(NSURLSessionDataTask *task, id responseObject) {\r\n                                              NSLog( @\"Upload response: %@\", responseObject );\r\n                                              TM_CALL_BLOCK( success );\r\n                                              sessionManager = nil;\r\n                                            }\r\n                                            failure:^(NSURLSessionDataTask *task, NSError *error) {\r\n                                              TM_CALL_BLOCK( failure, error );\r\n                                              sessionManager = nil;\r\n                                            }];\r\n}\r\n```\r\n\r\n... `url` is my S3 bucket URL, `params` does contain credentials, etc. This gives me 411 - content-length required. Serializer creates correct request (see attached image). But when you do create `NSURLSessionDataTask` at line 191 in AFHTTPSessionManager (POST:... method) you do call `[self dataTaskWithRequest:completionHandler:]` and this method does call `dataTaskWithRequest:` of `NSURLSession`. According to documentation, `dataTaskWithRequest:` creates `GET` request. It's probably the reason why `Content-Length` is removed from this request.\r\n\r\n![screen shot 2013-09-30 at 20 26 26](https://f.cloud.github.com/assets/1084172/1239688/eee7ff58-29fe-11e3-9899-9333e6bbf095.png)\r\n"},"comment":{"url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/comments/68970175","html_url":"https://github.com/AFNetworking/AFNetworking/issues/1398#issuecomment-68970175","issue_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1398","id":68970175,"user":{"login":"SSCedric","id":6848141,"avatar_url":"https://avatars.githubusercontent.com/u/6848141?v=3","gravatar_id":"","url":"https://api.github.com/users/SSCedric","html_url":"https://github.com/SSCedric","followers_url":"https://api.github.com/users/SSCedric/followers","following_url":"https://api.github.com/users/SSCedric/following{/other_user}","gists_url":"https://api.github.com/users/SSCedric/gists{/gist_id}","starred_url":"https://api.github.com/users/SSCedric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SSCedric/subscriptions","organizations_url":"https://api.github.com/users/SSCedric/orgs","repos_url":"https://api.github.com/users/SSCedric/repos","events_url":"https://api.github.com/users/SSCedric/events{/privacy}","received_events_url":"https://api.github.com/users/SSCedric/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T02:23:28Z","updated_at":"2015-01-07T02:23:28Z","body":"i found that `[request.HTTPBodyStream writeToTemporaryFileWithError]` method is not work.Because of HTTPBodyStream is a NSInputStream,it doesn't have method `writeToTemporaryFileWithError:`"}}