class Marten::HTTP::Headers

Overview

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

Included Modules

Defined in:

marten/http/headers.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(headers : ::HTTP::Headers) #

[View source]
def self.new #

[View source]

Instance Method Detail

def ==(other : self) #

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


[View source]
def [](name : String | Symbol) #

Returns the first value associated with the passed header name.


[View source]
def []=(name : String | Symbol, value) #

Allows to set a specific header.


[View source]
def []?(name : String | Symbol) #

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


[View source]
def delete(name : String | Symbol) : String | Nil #

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


[View source]
def each(*args, **options) #

Allows to iterate over all the headers.


[View source]
def each(*args, **options, &) #

Allows to iterate over all the headers.


[View source]
def empty?(*args, **options) #

Returns true if there are no headers.


[View source]
def empty?(*args, **options, &) #

Returns true if there are no headers.


[View source]
def 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).


[View source]
def fetch(name : String | Symbol, &) #

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


[View source]
def has_key?(name : String | Symbol) #

Returns true if the header with the provided name exists.


[View source]
def patch_vary(*headers : String) : Nil #

Allows to add header names to the Vary header.


[View source]
def size(*args, **options) #

Returns the number of headers.


[View source]
def size(*args, **options, &) #

Returns the number of headers.


[View source]