Browse Source

Added hanlding of valid NSData object with 0 bytes for serializers

mike.owens 11 years ago
parent
commit
d8c9a91257
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/Alamofire.swift

+ 2 - 2
Source/Alamofire.swift

@@ -1361,7 +1361,7 @@ extension Request {
     */
     public class func JSONResponseSerializer(options: NSJSONReadingOptions = .AllowFragments) -> Serializer {
         return { (request, response, data) in
-            if data == nil {
+            if data == nil || data?.length == 0 {
                 return (nil, nil)
             }
 
@@ -1410,7 +1410,7 @@ extension Request {
     */
     public class func propertyListResponseSerializer(options: NSPropertyListReadOptions = 0) -> Serializer {
         return { (request, response, data) in
-            if data == nil {
+            if data == nil || data?.length == 0 {
                 return (nil, nil)
             }