今天遇到 Request failed: method not allowed (405)。 错误,特此在网上翻了翻

Posted 奔丶小康

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了今天遇到 Request failed: method not allowed (405)。 错误,特此在网上翻了翻相关的知识,希望对你有一定的参考价值。

Q1: 遇到405请求错误。提示:
NSLocalizedDescription=Request failed: method not allowed (405)。
解决方案:405请求方法不被允许。这时候应该检查请求方法是否正确,页面应该用GET请求还是POST请求。例如在请求微博access_token的时候虽然不需要发送数据但这个页面却要求使用POST请求。


Q2: 使用AFNetwork进行HTTP请求遇到如下提示信息错误:
NSLocalizedDescription=Request failed: unacceptable 
content-type: text/plain。
解决方案:这里的错误提示是因为AFHTTPRequestOperationManager默认的http请求头没有包含text/plain格式。应使用
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/plain"];手动添加。当然也可能会出现text/html类型的。解决方案同理手动添加。

 

转自:

http://blog.csdn.net/cnlf14/article/details/44997111

以上是关于今天遇到 Request failed: method not allowed (405)。 错误,特此在网上翻了翻的主要内容,如果未能解决你的问题,请参考以下文章

iOS 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html

AFNetworking 遇到错误 Code=-1016 "Request failed: unacceptable content-type: text/plain"

CSRF verification failed. Request aborted.

Meth | Linux 修改所有者/用户组

Dynamics 365 msis 7069 The specified request failed

关于dubbo调度时出现Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Faile