• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting the content-type in a HTTP response
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting the content-type in a HTTP response
      • From: Bill Garrison <email@hidden>
    • Re: Getting the content-type in a HTTP response
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: NSCell field editor inconsistent drawing: single-click vs. carriage return
  • Next by Date: The mouse is where?
  • Previous by thread: NSCell field editor inconsistent drawing: single-click vs. carriage return
  • Next by thread: Re: Getting the content-type in a HTTP response
  • Index(es):
    • Date
    • Thread