Skip to content

Instantly share code, notes, and snippets.

@0xced
Created February 19, 2013 15:26
Show Gist options
  • Save 0xced/4986844 to your computer and use it in GitHub Desktop.
Save 0xced/4986844 to your computer and use it in GitHub Desktop.
-[NSHTTPURLResponse allHeaderFields] returns a case-insensitive dictionary.
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
@autoreleasepool
{
NSDictionary *headerFields = @{ @"ETag" : @"12345678" };
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"http://www.example.com"] statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:headerFields];
NSLog(@"1. eTaG: %@", [[response allHeaderFields] objectForKey:@"eTaG"]);
NSLog(@"2. eTaG: %@", [headerFields objectForKey:@"eTaG"]);
}
}
@0xced
Copy link
Author

0xced commented Feb 19, 2013

1. eTaG: 12345678
2. eTaG: (null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment