From 15b79263644e9310d2b976a882e7583ebb8b0dbb Mon Sep 17 00:00:00 2001 From: Oliver Letterer Date: Thu, 16 May 2013 21:01:02 +0200 Subject: [PATCH] Adds testXMLRequestOperationContruction. --- Tests/AFHTTPClientTests.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/AFHTTPClientTests.m b/Tests/AFHTTPClientTests.m index 5795627..821c59e 100644 --- a/Tests/AFHTTPClientTests.m +++ b/Tests/AFHTTPClientTests.m @@ -56,6 +56,19 @@ expect([operation class]).to.equal([AFJSONRequestOperation class]); } +- (void)testXMLRequestOperationContruction { + NSMutableURLRequest *request = [self.client requestWithMethod:@"GET" path:@"/path" parameters:nil]; + [request setValue:@"application/xml" forHTTPHeaderField:@"Accept"]; + + AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL]; + expect([operation class]).to.equal([AFHTTPRequestOperation class]); + + expect([AFXMLRequestOperation canProcessRequest:request]).to.beTruthy(); + [self.client registerHTTPOperationClass:[AFXMLRequestOperation class]]; + operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL]; + expect([operation class]).to.equal([AFXMLRequestOperation class]); +} + - (void)testThatTheDefaultStringEncodingIsUTF8 { expect(self.client.stringEncoding).to.equal(NSUTF8StringEncoding); }