[英]HTTP status code for unaccepted Content-Type in request
For certain resources, my RESTful server only accepts PUT
and POST
requests with JSON objects as the content body, thus requiring a Content-Type
of application/json
instead of application/x-www-form-urlencoded
or multipart/form-data
or anything else. 对于某些资源,我的RESTful服务器只接受以JSON对象作为内容主体的
PUT
和POST
请求,因此需要Content-Type
of application/json
而不是application/x-www-form-urlencoded
或multipart/form-data
或任何东西其他。
Malformed JSON (or lack thereof) returns a 400
with the error message taken directly from the exception raised by the JSON parser, for debugging purposes. 格式错误的JSON(或缺少JSON)返回
400
,其中错误消息直接取自JSON解析器引发的异常,以进行调试。
Which HTTP error code means that the client sent a request with an unacceptable Content-Type
, even if the server could technically parse the request content? 哪个HTTP错误代码意味着客户端发送了具有不可接受的
Content-Type
的请求,即使服务器可以在技术上解析请求内容?
根据此列表,它可能是415 Unsupported Media Type
: http : //www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.