ios 设置head请求头,自定义head, read response header
AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];
manger.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
manger.requestSerializer = [AFJSONRequestSerializer serializer];
manger.responseSerializer = [AFJSONResponseSerializer serializer];
[manger.requestSerializer setValue:@"123456" forHTTPHeaderField:@"uid"];
[manger.requestSerializer setValue:@"78912345" forHTTPHeaderField:@"token"]
http://stackoverflow.com/questions/20421028/afnetworking-2-0-how-to-read-response-header
//同理
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager.requestSerializer setValue:@"value" forHTTPHeaderField:@"name"];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
if ([httpResponse respondsToSelector:@selector(allHeaderFields)]) {
NSDictionary *dictionary = [httpResponse allHeaderFields];
NSLog([dictionary description]);
}