class ActionDispatch::Http::Headers

def fetch(key, default = DEFAULT)

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

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

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