Skip to content

Instantly share code, notes, and snippets.

@carlj
Created April 5, 2013 18:35
Show Gist options
  • Save carlj/5321559 to your computer and use it in GitHub Desktop.
Save carlj/5321559 to your computer and use it in GitHub Desktop.
NSURL *url = [NSURL URLWithString:@"http://cache-tester.herokuapp.com/contacts.json"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
[req setValue:@"\"3aa02883a2552b735e60c74ba4100548\"" forHTTPHeaderField:@"If-None-Match"];
AFJSONRequestOperation *op = [AFJSONRequestOperation JSONRequestOperationWithRequest:req
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSLog(@"%s succes: %d",__FUNCTION__, response.statusCode );
NSLog(@"%s succes %@", __FUNCTION__, [response.allHeaderFields objectForKey:@"ETag"]);
} failure:^(NSURLRequest *request,
NSHTTPURLResponse *response,
NSError *error, id JSON) {
NSLog(@"%s failed: %d %@",__FUNCTION__, response.statusCode, error );
}];
[op start];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment