Avoid appending empty form data parts.
AFQueryStringComponentsFromKeyAndValue() always returns at least one component (even if its `value` parameter is `nil`). If a component doesn't have any form data, there's no need for us to append an empty, nameless part to the multipart body. Additional improvements to consider (which are not mutually exclusive with this change): - Don't run this loop at all when `parameters` is `nil`. - Change AFQueryStringComponentsFromKeyAndValue() to return an empty iterable when its `value` paramter is `nil`.
This commit is contained in:
parent
ebdac4a01d
commit
002cbe74af
1 changed files with 3 additions and 1 deletions
|
|
@ -509,7 +509,9 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
|
|||
data = [[component.value description] dataUsingEncoding:self.stringEncoding];
|
||||
}
|
||||
|
||||
[formData appendPartWithFormData:data name:[component.key description]];
|
||||
if (data) {
|
||||
[formData appendPartWithFormData:data name:[component.key description]];
|
||||
}
|
||||
}
|
||||
|
||||
if (block) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue