如何在Rack :: MockRequest中设置cookie?

时间:2014-05-12 06:07:23

标签: ruby rack

我想在使用Rack::MockRequest

发出请求时设置Cookie
cookie = "_session_id=123"
client = Rack::MockRequest.new(@app)

#something like this?
response = client.get("/", "Cookie" => cookie) 

我该怎么做?

1 个答案:

答案 0 :(得分:1)

response = client.get('/', "HTTP_COOKIE" => cookie)