Let's take a look at an options request to the Twilio API. Here, we can see the first line of our request uses the options method.
Усыпальница Ярлана Зея могла бы быть возведена и строителями храмов самых первых цивилизаций из всех известных человечеству, хотя они даже отдаленно не смогли бы себе представить, из какого материала она выстроена.
Much like get and head, there is no request body, just the first line, and the request headers. The Twilio API has responded with a family status code, as well as a set of response headers to provide us some additional metadata.
The most frequently used response header when responding to options requests is the allow header. This header is used to indicate the allowed HTTP methods that can be used when interacting with our resource.
Here, we can see the Twilio API is indicating that head, options, and get are the valid methods that can be used with this resource.
In addition to the allow header, there are a set of headers being used to control cross-origin resource sharing, which is the mechanism that allows browsers to interact with APIs options method hosted on their own origin server.
For instance, if you have your own web application that would like to directly make Options method requests to Twilio from the browser. Here, we can see that Twilio is indicating that any origin server can be used with cross-origin resource sharing, as well as which HTTP headers can be included in those requests, and which HTTP headers in the response will be exposed to the browser client.
To summarize, the HTTP options method is used to discover options method ways we can interact with a certain resource, such as which HTTP methods are allowed, or the various controls of cross-origin resource sharing. Search for Lessons and Courses content.