Getting the content-type in a HTTP response
Getting the content-type in a HTTP response
- Subject: Getting the content-type in a HTTP response
- From: Dave Carrigan <email@hidden>
- Date: Fri, 25 Jan 2008 14:44:56 -0800
I need to get the content-type of a HTTP response. My delegate code
looks like:
- (void)connection:(NSURLConnection*)connection didReceiveResponse:
(NSURLResponse*)theResponse
{
NSString* content_type = [[(NSHTTPURLResponse*)theResponse
allHeaderFields] valueForKey:@"content-type"];
}
It doesn't work. The reason it doesn't work is because the server is
returning the header as "Content-Type", and the dictionary returned by
allHeaderFields method has case-sensitive keys, even though the HTTP
spec clearly says that HTTP header names are case-insensitive.
Is there something I'm missing, or was Apple really this shortsighted
in designing this API?
--
Dave Carrigan
email@hidden
Seattle, WA, USA
Attachment:
PGP.sig
Description: This is a digitally signed message part
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden