|
@@ -188,6 +188,7 @@
|
|
nilTask = [self.manager
|
|
nilTask = [self.manager
|
|
GET:@"test"
|
|
GET:@"test"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:nil
|
|
success:nil
|
|
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
|
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
|
@@ -234,6 +235,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"image"
|
|
GET:@"image"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
if (downloadProgress.fractionCompleted == 1.0) {
|
|
if (downloadProgress.fractionCompleted == 1.0) {
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -255,6 +257,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
POST:@"post"
|
|
POST:@"post"
|
|
parameters:payload
|
|
parameters:payload
|
|
|
|
+ headers:nil
|
|
progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
if (uploadProgress.fractionCompleted == 1.0) {
|
|
if (uploadProgress.fractionCompleted == 1.0) {
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -276,6 +279,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
POST:@"post"
|
|
POST:@"post"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
[formData appendPartWithFileData:[payload dataUsingEncoding:NSUTF8StringEncoding] name:@"AFNetworking" fileName:@"AFNetworking" mimeType:@"text/html"];
|
|
[formData appendPartWithFileData:[payload dataUsingEncoding:NSUTF8StringEncoding] name:@"AFNetworking" fileName:@"AFNetworking" mimeType:@"text/html"];
|
|
}
|
|
}
|
|
@@ -289,6 +293,75 @@
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+# pragma mark - Deprecated Progress
|
|
|
|
+
|
|
|
|
+- (void)testDownloadProgressIsReportedForDeprecatedGET {
|
|
|
|
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ GET:@"image"
|
|
|
|
+ parameters:nil
|
|
|
|
+ progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
|
|
+ if (downloadProgress.fractionCompleted == 1.0) {
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ success:nil
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testUploadProgressIsReportedForDeprecatedPOST {
|
|
|
|
+ NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"];
|
|
|
|
+ while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) {
|
|
|
|
+ [payload appendString:@"AFNetworking"];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ POST:@"post"
|
|
|
|
+ parameters:payload
|
|
|
|
+ progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
|
+ if (uploadProgress.fractionCompleted == 1.0) {
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ success:nil
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testUploadProgressIsReportedForStreamingDeprecatedPost {
|
|
|
|
+ NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"];
|
|
|
|
+ while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) {
|
|
|
|
+ [payload appendString:@"AFNetworking"];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ POST:@"post"
|
|
|
|
+ parameters:nil
|
|
|
|
+ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
|
|
+ [formData appendPartWithFileData:[payload dataUsingEncoding:NSUTF8StringEncoding] name:@"AFNetworking" fileName:@"AFNetworking" mimeType:@"text/html"];
|
|
|
|
+ }
|
|
|
|
+ progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
|
+ if (uploadProgress.fractionCompleted == 1.0) {
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ success:nil
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
# pragma mark - HTTP Status Codes
|
|
# pragma mark - HTTP Status Codes
|
|
|
|
|
|
- (void)testThatSuccessBlockIsCalledFor200 {
|
|
- (void)testThatSuccessBlockIsCalledFor200 {
|
|
@@ -296,6 +369,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"status/200"
|
|
GET:@"status/200"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -309,6 +383,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"status/404"
|
|
GET:@"status/404"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:nil
|
|
success:nil
|
|
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
|
|
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
|
|
@@ -323,6 +398,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"status/204"
|
|
GET:@"status/204"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
urlResponseObject = responseObject;
|
|
urlResponseObject = responseObject;
|
|
@@ -340,6 +416,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"get"
|
|
GET:@"get"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
XCTAssertNotNil(responseObject);
|
|
XCTAssertNotNil(responseObject);
|
|
@@ -354,6 +431,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
HEAD:@"get"
|
|
HEAD:@"get"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task) {
|
|
XCTAssertNotNil(task);
|
|
XCTAssertNotNil(task);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -367,8 +445,10 @@
|
|
[self.manager
|
|
[self.manager
|
|
POST:@"post"
|
|
POST:@"post"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:@{@"field":@"value"}
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
}
|
|
}
|
|
@@ -381,6 +461,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
POST:@"post"
|
|
POST:@"post"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:@{@"field":@"value"}
|
|
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
[formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding]
|
|
[formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding]
|
|
name:@"DataName"
|
|
name:@"DataName"
|
|
@@ -389,6 +470,7 @@
|
|
}
|
|
}
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]);
|
|
XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -402,7 +484,9 @@
|
|
[self.manager
|
|
[self.manager
|
|
PUT:@"put"
|
|
PUT:@"put"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:@{@"field":@"value"}
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
}
|
|
}
|
|
@@ -415,7 +499,9 @@
|
|
[self.manager
|
|
[self.manager
|
|
DELETE:@"delete"
|
|
DELETE:@"delete"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:@{@"field":@"value"}
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
}
|
|
}
|
|
@@ -428,7 +514,9 @@
|
|
[self.manager
|
|
[self.manager
|
|
PATCH:@"patch"
|
|
PATCH:@"patch"
|
|
parameters:@{@"key":@"value"}
|
|
parameters:@{@"key":@"value"}
|
|
|
|
+ headers:@{@"field":@"value"}
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
}
|
|
}
|
|
@@ -439,7 +527,7 @@
|
|
|
|
|
|
#pragma mark - Deprecated Rest Interface
|
|
#pragma mark - Deprecated Rest Interface
|
|
|
|
|
|
-- (void)testDeprecatedGET {
|
|
|
|
|
|
+- (void)testDeprecatedGETWithoutProgress {
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
@@ -455,7 +543,7 @@
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)testDeprecatedPOST {
|
|
|
|
|
|
+- (void)testDeprecatedPOSTWithoutProgress {
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
@@ -471,7 +559,7 @@
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
}
|
|
}
|
|
|
|
|
|
-- (void)testDeprecatedPOSTWithConstructingBody {
|
|
|
|
|
|
+- (void)testDeprecatedPOSTWithoutProgressWithConstructingBody {
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
@@ -494,6 +582,129 @@
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
[self waitForExpectationsWithCommonTimeout];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedGETWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ GET:@"get"
|
|
|
|
+ parameters:nil
|
|
|
|
+ progress:nil
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertNotNil(responseObject);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedHEADWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ HEAD:@"get"
|
|
|
|
+ parameters:nil
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task) {
|
|
|
|
+ XCTAssertNotNil(task);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedPOSTWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ POST:@"post"
|
|
|
|
+ parameters:@{@"key":@"value"}
|
|
|
|
+ progress:nil
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedPOSTWithoutHeadersWithConstructingBody {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ POST:@"post"
|
|
|
|
+ parameters:@{@"key":@"value"}
|
|
|
|
+ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
|
|
+ [formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding]
|
|
|
|
+ name:@"DataName"
|
|
|
|
+ fileName:@"DataFileName"
|
|
|
|
+ mimeType:@"data"];
|
|
|
|
+ }
|
|
|
|
+ progress:nil
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]);
|
|
|
|
+ XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedPUTWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ PUT:@"put"
|
|
|
|
+ parameters:@{@"key":@"value"}
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedDELETEWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ DELETE:@"delete"
|
|
|
|
+ parameters:@{@"key":@"value"}
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)testDeprecatedPATCHWithoutHeaders {
|
|
|
|
+ XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+ [self.manager
|
|
|
|
+ PATCH:@"patch"
|
|
|
|
+ parameters:@{@"key":@"value"}
|
|
|
|
+ success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
|
+ XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
|
|
|
|
+ [expectation fulfill];
|
|
|
|
+ }
|
|
|
|
+ failure:nil];
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+ [self waitForExpectationsWithCommonTimeout];
|
|
|
|
+}
|
|
|
|
+
|
|
#pragma mark - Auth
|
|
#pragma mark - Auth
|
|
|
|
|
|
- (void)testHiddenBasicAuthentication {
|
|
- (void)testHiddenBasicAuthentication {
|
|
@@ -502,6 +713,7 @@
|
|
[self.manager
|
|
[self.manager
|
|
GET:@"hidden-basic-auth/user/password"
|
|
GET:@"hidden-basic-auth/user/password"
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
[expectation fulfill];
|
|
[expectation fulfill];
|
|
@@ -574,6 +786,7 @@
|
|
[manager
|
|
[manager
|
|
GET:@""
|
|
GET:@""
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
XCTFail(@"Request should fail");
|
|
XCTFail(@"Request should fail");
|
|
@@ -598,6 +811,7 @@
|
|
[manager
|
|
[manager
|
|
GET:@""
|
|
GET:@""
|
|
parameters:nil
|
|
parameters:nil
|
|
|
|
+ headers:nil
|
|
progress:nil
|
|
progress:nil
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
XCTFail(@"Request should fail");
|
|
XCTFail(@"Request should fail");
|