Skip to content

Commit 3382b46

Browse files
committed
Merge pull request Alamofire#254 from mowens/bug/handle-0-bytes
Added hanlding of valid NSData object with 0 bytes for serializers
2 parents d41b8da + d8c9a91 commit 3382b46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/Alamofire.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ extension Request {
13661366
*/
13671367
public class func JSONResponseSerializer(options: NSJSONReadingOptions = .AllowFragments) -> Serializer {
13681368
return { (request, response, data) in
1369-
if data == nil {
1369+
if data == nil || data?.length == 0 {
13701370
return (nil, nil)
13711371
}
13721372

@@ -1415,7 +1415,7 @@ extension Request {
14151415
*/
14161416
public class func propertyListResponseSerializer(options: NSPropertyListReadOptions = 0) -> Serializer {
14171417
return { (request, response, data) in
1418-
if data == nil {
1418+
if data == nil || data?.length == 0 {
14191419
return (nil, nil)
14201420
}
14211421

0 commit comments

Comments
 (0)