<!doctype html>
HTTP状态 412 - 前置条件失败
类型 状态报告
描述 在服务器上测试时,请求头字段中给出的一个或多个条件被评估为false。
Apache Tomcat/10.0.10
加上
[request setCachePolicy:NSURLRequestReturnCacheDataElseLoad];
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:requestUrl parameters:nil error:nil];
request.timeoutInterval= 30;
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// 设置body 在这里将参数放入到body
// [request setHTTPBody:data];
AFHTTPResponseSerializer *responseSerializer = [AFHTTPResponseSerializer serializer];
responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/html", @"text/json",@"text/javascript", @"text/plain", nil];
manager.responseSerializer = responseSerializer;
[request setCachePolicy:NSURLRequestReturnCacheDataElseLoad];