//manager.requestSerializer setValue:<#(NSString *)#> forHTTPHeaderField:<#(NSString *)#>
key:value
- (void)addRequest:(NSMutableDictionary *)parDic
url:(NSString *)url
completionBlock:(completeBlock)comletionBlock{
// [self getSign:parDic];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
//申明返回的结果类型
manager.responseSerializer = [AFJSONResponseSerializer serializer];
//申明请求的数据类型
manager.requestSerializer=[AFHTTPRequestSerializer serializer];
manager.requestSerializer.timeoutInterval = 30;
//af设置请求头
//manager.requestSerializer setValue:<#(NSString *)#> forHTTPHeaderField:<#(NSString *)#>
[manager POST:[self fullUrl:url]
parameters:parDic
success:^(AFHTTPRequestOperation *operation,id responseObject) {
NSDictionary *resultDic = (NSDictionary *)responseObject;
if (comletionBlock) {
comletionBlock(resultDic, nil);
}
}failure:^(AFHTTPRequestOperation *operation,NSError *error) {
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"-1001",@"JJ_TAG_PARAM_R_CODE",@"JJ_ERROR_MSG",@"JJ_TAG_PARAM_R_MSG", nil];
if (comletionBlock) {
comletionBlock(dict,error);
}
}];
}