I want to set a cookie when making a request with Rack::MockRequest

cookie = "_session_id=123"
client = Rack::MockRequest.new(@app)

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

How do I do it?

有帮助吗?

解决方案

try

response = client.get('/', "HTTP_COOKIE" => cookie)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top