If a HTTP resource is not able to handle a request with the given HTTP method, it should send an Allow
header to list the allowed HTTP methods. Another possibility to get a response with an Allow
header is to send a request with the OPTIONS
method.
I'm wondering whether the Allow
header should contain the OPTIONS
method itself.
Example:
Allow: GET, PUT, DELETE, OPTIONS
or
Allow: GET, PUT, DELETE
What is correct?
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value is ignored.
The allow-header entry specifies which headers are presented in preflight responses to clients as acceptable to use when making cross-origin requests to resources which this policy is applicable to.
Prevent sending the post data, if it wont be processed This is the only reason what is valid. Using options request will prevent sending the post data to the server unnecessarily.
The HTTP OPTIONS method is used to describe the communication options for the target resource. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.
I don't see why not. The OPTIONS
request method is used to request information about the communication options available for the requested URI. Some clients use OPTIONS
to determine communication requirements and the server's capabilities without having to retrieve or perform an action on the requests resource.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With