I've just started using AFNetworking 2.0 and I was wondering how I put in headers into a HTTP Get request. The documentation sets up a GET like this:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"foo": @"bar"};
[manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
But since we're not handling NSURLRequests
I'm not sure how to set HTTP Headers.
Any help would be appreciated.
Regards,
Mike
setDefaultHeader
sucks. A 30 second search of the docs and I find AFHTTPRequestSerializer is responsible for HTTPHeaders on a per-request basis. – RyanRmanager.requestSerializer setValue:<#(NSString *)#> forHTTPHeaderField:<#(NSString *)#>
– Mackey18