Fork me on GitHub

I want to figure out which methods are supported on a resource.

use the OPTIONS method for this:

OPTIONS /my/resource HTTP/1.1
Host: example.org
HTTP/1.1 200 OK
Allow: HEAD,GET,DELETE,OPTIONS

Even though it's not defined, this method CAN return a message body. It will return an ALLOW header, that returns all the methods the current resource is capable of handling.

If resources require authentication, it is possible that OPTIONS returns more methods once you added authentication headers to the request.

OPTIONS /a/resource HTTP/1.1
Host: example.org
HTTP/1.1 200 OK
Allow: HEAD,GET,OPTIONS
OPTIONS /a/resource HTTP/1.1
Host: example.org
Authentication: .....
HTTP/1.1 200 OK
Allow: HEAD,GET,PUT,POST,DELETE,OPTIONS

See also

Caveats

  • OPTIONS is not a very common implemented method.

Please enable JavaScript to view the comments powered by Disqus.

Topics

AltStyle によって変換されたページ (->オリジナル) /