I have a problem with my NSMutableURLRequest. My server supports both JSON and XML formats and they are separated with an access header. It also defaults to JSON if no access header is set. Which basically means that when I want the response in XML I need to create a request with 'application/xml' as access header.
The problem I'm facing now is that even if I pass in the correct access header to get the response in XML I still end up with JSON (because that's default). It's like my request disregards the access header. Is there anything else I need to create in order to make my request work with headers?
The request is really simple:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"application/xml" forHTTPHeaderField:@"Accept"];
I have confirmed that my request contains my headers by printing allHTTPHeaderFields:
headers: {
Accept = "application/xml";
}