Method: Rack::Request::Helpers#cookies

Defined in:
lib/rack/request.rb

#cookiesObject



298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/rack/request.rb', line 298

def cookies
  hash = fetch_header(RACK_REQUEST_COOKIE_HASH) do |key|
    set_header(key, {})
  end

  string = get_header(HTTP_COOKIE)

  unless string == get_header(RACK_REQUEST_COOKIE_STRING)
    hash.replace Utils.parse_cookies_header(string)
    set_header(RACK_REQUEST_COOKIE_STRING, string)
  end

  hash
end