rjz / supertest-session

Persistent sessions for supertest
Other
88 stars 21 forks source link

Don't send Expires options #5

Closed Quentin01 closed 9 years ago

Quentin01 commented 9 years ago

Hi,

In my use-case I have cookies with the option "Expires", so I send headers like that :

Set-Cookie : connect.sid=s%3AlMtQUjJP9PkhsoIlWwFCMjm-rawiAuS4.aIvx9Vi%2BEisilzFza9SO6U7Ko8doDy4QF5ypVWTCz%2BI; Path=/; Expires=Mon, 17 Nov 2014 13:53:31 GMT; HttpOnly

But with this lib when I make a request you remove the parameter "Path" but keep "Expires". Here is an example :

Cookies : connect.sid=s:QGr6asW74gtqnC-PQ_bsP2wXHG3por9U.EejvZh2m2TU6i3te4LIcmBNCUsTYqDHDBTvkc5OkLA8,Expires=Mon, 17 Nov 2014 13:59:54 GMT

If I'm not mistaken, it would remove "Expires".

rjz commented 9 years ago

Definitely a bug—thanks, @Quentin01!

Rather than filtering Path as we do right now, we should not be sending back any of the attribute-value pairs that appear after the initial name=path in the Set-Cookie header. I've pushed a branch (spec-5) that generates a general failure. I'd be happy to merge a fix if you have time; otherwise I'll follow up shortly.