Added method for custom file type

This commit is contained in:
Kevin Harwood 2013-05-16 14:26:34 -05:00
parent d4fbdfa228
commit 9d979991a4

View file

@ -45,6 +45,15 @@
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestOperationAcceptsCustomContentType{
[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"application/customjson"]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=application/customjson" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];
expect([operation isFinished]).will.beTruthy();
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestOperationDoesNotAcceptInvalidContentType{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=application/no-json" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];