Can an HTTP OPTIONS request return 204 or should it always return 200?

According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2 , the only answer ever mentioned regarding an HTTP OPTIONS request is 200. However, there seem to be cases like when the content length is 0, which would be more appropriate. Does the HTTP OPTIONS request match return 204?

+5
source share
2 answers

Yes, it can return 204. Or 400. Or 400. There are no general restrictions on what status codes a method can return.

, RFC 2616. . http://trac.tools.ietf.org/wg/httpbis/trac/wiki.

+5

RFC 2616 :

200 200 ...

...

, Content-Length "0".

, 200 . , ( ).

RFC 7231, RFC 2616,

, , ...

...

Content-Length "0", .

2xx , .

, Content-Length . Content-Length 204:

RFC 2616 :

Content-Length Transfer-Encoding...

... 1xx (), 204 ( ) 304 ( ) .

RFC 7230 :

Content-Length 1xx () 204 ( ).

.

+8

All Articles