Making unsupported HTTP OPTIONS requests with command-line tools
Sometimes, we don't know which are the HTTP methods or verbs that a resource or resource collection supports in a RESTful Web Service. In order to provide a solution to this problem, we can compose and send an HTTP request with the OPTIONS
HTTP verb and the URL for the resource or the resource collection.
If the RESTful Web Service implements the OPTIONS
HTTP verb for a resource or resource collection, it will build a response with an Allow
key in the response header. The value for this key will include a comma-separated list of HTTP verbs or methods that it supports. In addition, the response header will include additional information about other supported options, such as the content type it is capable of parsing from the request and the content type it is capable of rendering in the response.
For example, if we want to know which HTTP verbs the toys collection supports, we can run the following command:
http OPTIONS :8000/toys...