AFNetworking请求设置请求头
NSString *url = @"INPUT URL HERE";
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager.requestSerializer setValue:@"qingqiu/json" forHTTPHeaderField:@"Accept"];
[manager.requestSerializer setValue:@"zhelishiqingqiutou; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
//查看请求头
NSLog(@"---%@",manager.requestSerializer.HTTPRequestHeaders);
[manager POST:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"成功 ");
}
failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
NSLog(@"失败 ");
}];