Well, in that case the Mozilla documentation is plainly wrong.
What HTTP response code should be used for an OPTION request?
-
06-03-2022 - |
Frage
I noticed that the Mozilla HTTP response codes documentation states that
The methods PUT, DELETE, and OPTIONS can never result in a 200 OK response.
However it doesn't make clear what response should actually be used. My best guess would be 204:
204 : No Content
There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.
Can anyone comment as to whether or not this is the correct code to be using to response to an OPTIONS request?
Lösung 2
Andere Tipps
I use 204 No Content
because an OPTIONS
response doesn't have any content.
The (updated, btw) RFCs for HTTP 1.1 clearly state 200 OK
is an acceptable response for all 3 methods, see section 6.3.1 of RFC 7231.
RFC2616 clearly mentions a 200 response and requirements for a 200 response: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html