class

Marten::HTTP::Headers

Inherits Enumerable / Reference / Object

Represents a set of HTTP headers extracted from an HTTP request.

Constructors

new(headers : ::HTTP::Headers)
Source

Instance methods

==(other : self)

Returns true if the other headers object corresponds to the current headers.

Source
[](name : String | Symbol)

Returns the first value associated with the passed header name.

Source
[]=(name : String | Symbol, value)

Allows to set a specific header.

Source
[]?(name : String | Symbol)

Returns the first value associated with the passed header name or nil if the header is not present.

Source
delete(name : String | Symbol) : String | Nil

Deletes a specific header and return its value, or nil if the header does not exist.

Source
each(*args, **options)

Allows to iterate over all the headers.

Source
each(*args, **options, &)

Allows to iterate over all the headers.

Source
empty?(*args, **options)

Returns true if there are no headers.

Source
empty?(*args, **options, &)

Returns true if there are no headers.

Source
fetch(name : String | Symbol, default = nil)

Returns the value of the specified header name or fallback to the provided default value ( which is nilby default).

Source
fetch(name : String | Symbol, &)

Returns the value of the specified header name or calls the block with the name when not found.

Source
has_key?(name : String | Symbol)

Returns true if the header with the provided name exists.

Source
patch_vary(*headers : String) : Nil

Allows to add header names to the Vary header.

Source
size(*args, **options)

Returns the number of headers.

Source
size(*args, **options, &)

Returns the number of headers.

Source