class Marten::HTTP::Headers
- Marten::HTTP::Headers
- Reference
- Object
Overview
Represents a set of HTTP headers extracted from an HTTP request.
Included Modules
- Enumerable({String, Array(String)})
Defined in:
marten/http/headers.crConstructors
Instance Method Summary
-
#==(other : self)
Returns true if the other headers object corresponds to the current headers.
-
#[](name : String | Symbol)
Returns the first value associated with the passed header name.
-
#[]=(name : String | Symbol, value)
Allows to set a specific header.
-
#[]?(name : String | Symbol)
Returns the first value associated with the passed header name or
nil
if the header is not present. -
#delete(name : String | Symbol) : String | Nil
Deletes a specific header and return its value, or
nil
if the header does not exist. -
#each(*args, **options)
Allows to iterate over all the headers.
-
#each(*args, **options, &)
Allows to iterate over all the headers.
-
#empty?(*args, **options)
Returns
true
if there are no headers. -
#empty?(*args, **options, &)
Returns
true
if there are no headers. -
#fetch(name : String | Symbol, default = nil)
Returns the value of the specified header name or fallback to the provided default value ( which is
nil
by default). -
#fetch(name : String | Symbol, &)
Returns the value of the specified header name or calls the block with the name when not found.
-
#has_key?(name : String | Symbol)
Returns
true
if the header with the provided name exists. -
#patch_vary(*headers : String) : Nil
Allows to add header names to the Vary header.
-
#size(*args, **options)
Returns the number of headers.
-
#size(*args, **options, &)
Returns the number of headers.
Constructor Detail
Instance Method Detail
Returns the first value associated with the passed header name or nil
if the header is not present.
Deletes a specific header and return its value, or nil
if the header does not exist.
Returns the value of the specified header name or fallback to the provided default value ( which is nil
by
default).
Returns the value of the specified header name or calls the block with the name when not found.