HTTP OPTIONS请求可以返回204还是总是返回200? [英] Can an HTTP OPTIONS request return a 204 or should it always return 200?
问题描述
根据 http://www.w3.org/ Protocols / rfc2616 / rfc2616-sec9.html#sec9.2 有关HTTP OPTIONS请求的唯一响应是200.但是,似乎有一些情况,例如当内容长度为0时,一个204会更合适。 HTTP OPTIONS请求是否适合返回204?
According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2 the only response ever mentioned regarding an HTTP OPTIONS request is a 200. However, there seem to be cases such as when the content-length is 0 that a 204 would be more appropriate. Is it appropriate for an HTTP OPTIONS request to return a 204?
推荐答案
是的,它可以返回204.或400.或400关于方法可以返回什么状态代码没有一般限制。
Yes, it can return 204. Or 400. Or 400. There is no general restriction as to what status codes a method can return.
还要注意是时候停止查看RFC 2616.参见 http://trac.tools.ietf.org/wg/httpbis/trac/wiki 。
Also note that it's time to stop looking at RFC 2616. See http://trac.tools.ietf.org/wg/httpbis/trac/wiki.
这篇关于HTTP OPTIONS请求可以返回204还是总是返回200?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!