How to add lowercase field to NSURLRequest header field?

Posted by Drewsmits on Stack Overflow See other posts from Stack Overflow or by Drewsmits
Published on 2010-03-30T07:07:19Z Indexed on 2010/03/30 7:13 UTC
Read the original article Hit count: 526

I'm getting pretty frustrated figuring out how to add a lowercase header field to an NSMutableURLRequest.

NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:MyURLString]];
[urlRequest setValue:@"aValue" forHTTPHeaderField:@"field"];

In the example above, "field" get's switched to "Field," since the header field names are case insensitive. I wouldn't think this should happen, but it does. The API I am working with is case sensitive, so my GET request is ignored. Is there any way to override the case switch?

Thanks

© Stack Overflow or respective owner

Related posts about nsurlrequest

Related posts about lowercase