struct HTTP::Headers

Overview

A Hash-like object that holds HTTP headers.

Two headers are considered the same if their downcase representation is the same (in which _ is the downcase version of -).

Defined in:

http/headers.cr

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from struct Struct

==(other : self) : Bool ==, hash : Int32 hash, inspect(io : IO) : Nil inspect, to_s(io) to_s

Instance methods inherited from struct Value

==(other) ==

Instance methods inherited from class Object

!=(other) !=, !~(other) !~, ==(other) ==, ===(other)
===(other : YAML::Any)
===(other : JSON::Any)
===
, =~(other) =~, class class, clone clone, crystal_type_id crystal_type_id, dup dup, hash hash, inspect
inspect(io : IO)
inspect
, itself itself, not_nil! not_nil!, tap(&block) tap, to_json to_json, to_pretty_json(io : IO)
to_pretty_json
to_pretty_json
, to_s
to_s(io : IO)
to_s
, to_yaml(io : IO)
to_yaml
to_yaml
, try(&block) try

Class methods inherited from class Object

==(other : Class) ==, ===(other) ===, cast(other) : self cast, from_json(string_or_io) : self from_json, from_yaml(string : String) : self from_yaml, hash hash, inspect(io) inspect, name : String name, to_s(io) to_s, |(other : U.class) |

Class Method Detail

def self.new #

[View source]

Instance Method Detail

def ==(other : Hash) #

[View source]
def ==(other : self) #

[View source]
def [](key) #

[View source]
def []=(key, value : String) #

[View source]
def []=(key, value : Array(String)) #

[View source]
def []?(key) #

[View source]
def add(key, value : Array(String)) #

[View source]
def add(key, value : String) #

[View source]
def clone #

[View source]
def delete(key) #

[View source]
def dup #

[View source]
def each(&block) #

[View source]
def empty? #

[View source]
def fetch(key, default) #

[View source]
def fetch(key) #

[View source]
def fetch(key, &block) #

[View source]
def get(key) #

[View source]
def get?(key) #

[View source]
def has_key?(key) #

[View source]
def includes_word?(key, word) #

Returns if among the headers for key there is some that contains word as a value. The word is expected to match between word boundaries (i.e. non-alphanumeric chars).

headers = HTTP::Headers{"Connection": "keep-alive, Upgrade"}
headers.includes_word?("Connection", "Upgrade") # => true

[View source]
def inspect(io : IO) #

[View source]
def merge!(other) #

[View source]
def same?(other : HTTP::Headers) #

[View source]
def to_s(io : IO) #

[View source]

Macro Detail

macro method_missing(name, args, block) #

[View source]