格式不正确的POST正文的HTTP状态代码 [英] HTTP Status code for malformed POST body
本文介绍了格式不正确的POST正文的HTTP状态代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
REST响应包含格式错误/无法解析的消息正文的POST请求,REST服务应返回什么状态代码?
What status code should a REST service return in response to a POST request containing a malformed / unparseable message body?
推荐答案
400错误的请求
直接从规范:
由于格式错误,服务器无法理解该请求 句法.客户应在没有以下情况的情况下不重复请求 修改.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
或者,如果您需要更具体的状态,则可以创建您自己的4XX状态,无论您要设计什么API.
Alternatively, if you need a more specific status you can create your own 4XX status for whatever API you might be designing.
这篇关于格式不正确的POST正文的HTTP状态代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文