class ActionDispatch::Http::Headers

def fetch(key, default = DEFAULT)

its result returned.
If the code block is provided, then it will be run and

raises a KeyError exception.
If the key is not found and an optional code block is not provided,

Returns the value for the given key mapped to @env.
def fetch(key, default = DEFAULT)
  @req.fetch_header(env_name(key)) do
    return default unless default == DEFAULT
    return yield if block_given?
    raise KeyError, key
  end
end