HTTP Methods (5)

HTTP Headers (1)

Miscellaneous (3)

Resources (4)

Basics (5)

Mediatypes (1)

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

另请参见

注意

Copyright 2012 Joshua Thijssen and others. Like to contribute? Add your recipe to our github repository.
Looking for Puppet recipies? Try the Puppet CookBook.
Fork me on GitHub