class Protocol::HTTP::Methods
See <developer.mozilla.org/en-US/docs/Web/HTTP/Methods> for more details.
These methods are defined in this module using lower case names. They are for convenience only and you should not overload those methods.
| PATCH | Yes | Yes | No | No | No |
| TRACE | No | Yes | Yes | Yes | No |
| OPTIONS | Optional | Yes | Yes | Yes | No |
| CONNECT | Optional | Yes | No | No | No |
| DELETE | Optional | Yes | No | Yes | No |
| PUT | Yes | Yes | No | Yes | No |
| POST | Yes | Yes | No | No | Yes |
| HEAD | Optional | No | Yes | Yes | Yes |
| GET | Optional | Yes | Yes | Yes | Yes |
| ———– | ———— | ————- | —- | ———- | ——— |
| Method Name | Request Body | Response Body | Safe | Idempotent | Cacheable |
Provides a convenient interface for commonly supported HTTP methods.
def self.each
@parameter name [Symbol] The name of the method, e.g. `:GET`.
@yields {|name, value| ...}
Enumerate all HTTP methods.
def self.each return to_enum(:each) unless block_given? constants.each do |name| yield name.downcase, const_get(name) end end
def self.valid?(name)
Note that this method only knows about the methods defined in this module, however there are many other methods defined in different specifications.
Check if the given name is a valid HTTP method, according to this module.
def self.valid?(name) const_defined?(name) rescue NameError # Ruby will raise an exception if the name is not valid for a constant. return false end