Skip to content

Commit

Permalink
Adding missing nullability attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Racklyeft committed Nov 12, 2015
1 parent 2a6cf84 commit 60f93d7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
12 changes: 6 additions & 6 deletions AFNetworking/AFHTTPSessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

/**
Expand Down Expand Up @@ -179,7 +179,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

/**
Expand All @@ -196,7 +196,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

/**
Expand All @@ -211,7 +211,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

/**
Expand All @@ -226,7 +226,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

/**
Expand All @@ -241,7 +241,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;

@end
Expand Down
42 changes: 42 additions & 0 deletions Tests/Tests/AFHTTPSessionManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,46 @@ - (void)testThatSerializationErrorGeneratesErrorAndNullTaskForGET {
}


# pragma mark - Rest Interface

- (void)testThatSuccessBlockIsCalledFor200 {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
GET:@"status/200"
parameters:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
}

- (void)testThatFailureBlockIsCalledFor404 {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
GET:@"status/404"
parameters:nil
success:nil
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
}

- (void)testThatResponseObjectIsEmptyFor204 {
__block id urlResponseObject = nil;
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
GET:@"status/204"
parameters:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
urlResponseObject = responseObject;
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
XCTAssertNil(urlResponseObject);
}


@end

0 comments on commit 60f93d7

Please sign in to comment.