Skip to content

Request should return cookies, also when initially not set. #231

merged 1 commit into from Sep 16, 2011

3 participants


The last expectation fails. Whatever is put in the cookies hash disappears into a void. This commit fixes that.

    req =""))
    req.cookies['foo'] = 'bar'
    req.cookies.should.equal 'foo' => 'bar'
Official Rack repositories member
rkh commented Sep 2, 2011

I'm not sure whether writing to the cookie hash is something we should support, since it does not set a cookie.


Indeed, it's not about setting a cookie for the response. It's about having the ability to inject and/or delete a cookie before it's processed further down the stack.

If you don't feel that should be supported, then why is there code in the +cookies+ method that takes into account that @env["HTTP_COOKIE"] might change?

Writing to the cookies hash currently works fine when there's an initial set of cookies, it just doesn't work when the initial set of cookies is empty.

Official Rack repositories member
rkh commented Sep 5, 2011

Oh, yes, totally missed that use case.

Official Rack repositories member
raggi commented Sep 7, 2011

I will apply this if you wouldn't mind updating to merge cleanly with master.

Thank you for your submission


Hi raggi, done, see lawrencepit@cccacb1


Apologies, it's lawrencepit@02209e2

@raggi raggi merged commit 1b7f7af into rack:master Sep 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.