webmachine / webmachine-ruby

Webmachine, the HTTP toolkit (in Ruby)
http://rdoc.info/github/seancribbs/webmachine-ruby/master/frames
Other
852 stars 54 forks source link

Setting multiple cookies #239

Closed rfestag closed 7 years ago

rfestag commented 7 years ago

I think there is an issue with Response.set_cookie, although I'm a little confused at how the tests seem to be passing right now. On line 55, cookie is a string and the code tries to call Array.+(cookie). This shouldn't work (and doesn't appear to...try [] + '' in a console). However, the tests currently pass. I changed + to <<, and it appears to work.

Any idea what is going on? I can submit a pull request, but didn't want to make the change unless there was something I'm missing/misunderstanding.

seancribbs commented 7 years ago

I think you're right, @rfestag. It looks like the tests don't cover the case where Response.set_cookie would be called more than twice. I'd love to see a test to show this.

rfestag commented 7 years ago

@seancribbs: I just submitted a pull request that should simplify it. Instead of adding the first cookie as a string, it adds it as an array (so we can have only two cases...one where no cookies have been set, and one where at least one has been set). I still updated the multiple cookies test to add two cookies (instead of just one), to verify it works as expected.

240