Skip to content

Commit

Permalink
Don't let AFURLConnectionOperation accept a nil request
Browse files Browse the repository at this point in the history
Closes #1064
  • Loading branch information
kylef committed Jun 14, 2013
1 parent 2853215 commit babd06c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AFNetworking/AFURLConnectionOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ + (NSArray *)pinnedPublicKeys {
#endif

- (id)initWithRequest:(NSURLRequest *)urlRequest {
NSParameterAssert(urlRequest);

self = [super init];
if (!self) {
return nil;
Expand Down
4 changes: 4 additions & 0 deletions Tests/AFURLConnectionOperationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ - (void)setUp {

#pragma mark -

- (void)testInitWithNilRequestRaisesException {
expect(^{ (void)[[AFURLConnectionOperation alloc] initWithRequest:nil]; }).to.raiseAny();
}

- (void)testThatAFURLConnectionOperationInvokesWillSendRequestForAuthenticationChallengeBlock {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/path" relativeToURL:self.baseURL]];
AFURLConnectionOperation *operation = [[AFURLConnectionOperation alloc] initWithRequest:request];
Expand Down

0 comments on commit babd06c

Please sign in to comment.