forked from AFNetworking/AFNetworking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix property list response serializer to handle 204 responses
Fixes #1645
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// AFPropertyListResponseSerializerTests.m | ||
// AFNetworking Tests | ||
// | ||
// Created by Kyle Fuller on 29/11/2013. | ||
// Copyright (c) 2013 AFNetworking. All rights reserved. | ||
// | ||
|
||
#import "AFTestCase.h" | ||
|
||
#import "AFURLResponseSerialization.h" | ||
|
||
|
||
@interface AFPropertyListResponseSerializerTests : AFTestCase | ||
|
||
@end | ||
|
||
@implementation AFPropertyListResponseSerializerTests | ||
|
||
- (void)testThatPropertyListResponseSerializerHandles204 { | ||
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:204 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/x-plist"}]; | ||
|
||
id<AFURLResponseSerialization> serializer = [AFPropertyListResponseSerializer serializer]; | ||
NSError *error; | ||
id responseObject = [serializer responseObjectForResponse:response data:nil error:&error]; | ||
|
||
XCTAssertNil(responseObject, @"Response should be nil when handling 204 with application/x-plist"); | ||
XCTAssertNil(error, @"Error handling application/x-plist"); | ||
} | ||
|
||
@end |