今天用AFNetworking做了个接口请求报如下错误:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/css" UserInfo={NSLocalizedDescription=Request failed: unacceptable content-type: text/css, body=[{"RESULT":"1"}], NSErrorFailingURLKey=http://XXXXXX打码XXXXXX, statusCode=200, com.alamofire.serialization.response.error.data=<5b7b2252 4553554c 54223a22 31227d5d>, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x281af40e0> { URL: http://XXXXXX打码XXXXXX } { Status Code: 200, Headers {
"Content-Length" = (
16
);
"Content-Type" = (
"text/css;charset=UTF-8"
);
Date = (
"Tue, 24 Dec 2019 15:27:57 GMT"
);
Server = (
"Apache-Coyote/1.1"
);
"Set-Cookie" = (
"JSESSIONID=TeFZTu7O1WPvLa-6CVZZtvl7.undefined; Path=/AcuLife"
);
} }}<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
根据提示,表示不识别 'text/css'类型的数据,添加如下设置即可