本文介绍了HTTP 400(错误请求)用于逻辑错误,而不是格式错误的请求语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对状态码400,错误请求(第10.4.1节):
似乎有一个普遍的做法现在很少有基于HTTP的API使用400表示逻辑而不是带有请求的语法错误。我的猜测是API这样做是为了区分(客户诱导) )和(由服务器引起)。使用400表示非语法错误是否可接受或不正确?如果可以接受,RFC 2616上是否有注释参考,可以更深入地了解400的预期用途?
There seems to be a general practice among a few HTTP-based APIs these days to use 400 to mean a logical rather than a syntax error with a request. My guess is that APIs are doing this to distinguish between 400 (client-induced) and 500 (server-induced). Is it acceptable or incorrect to use 400 to indicate non-syntactic errors? If it is acceptable, is there an annotated reference on RFC 2616 that provides more insight into the intended use of 400?
示例:
- Google Data Protocol, Protocol Reference, HTTP Status Codes
推荐答案
状态422():
这篇关于HTTP 400(错误请求)用于逻辑错误,而不是格式错误的请求语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!