You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I want to record the user visit time in the header, I found the 0 value cannot set to cookie only if we convert it to string type, but other number type value can be saved.
I create one test to reproduce the issue:
it('when set value to 0',()=>{varcookie=newcookies.Cookie('foo',0);assert.equal(cookie.toHeader(),'foo=0; path=/; httponly')})//this will faileit('when set value to 1',()=>{varcookie=newcookies.Cookie('foo',1);assert.equal(cookie.toHeader(),'foo=1; path=/; httponly')})//this will pass
And I check the source code found this issue happens because of the index.js L:131
this.value = value || ""
This will convert the 0 to empty string, so I am woundering is this a bug or not, if not, I think we should notice the user we should always put he String type value.
The text was updated successfully, but these errors were encountered:
When I want to record the user visit time in the header, I found the
0
value cannot set to cookie only if we convert it to string type, but other number type value can be saved.I create one test to reproduce the issue:
And I check the source code found this issue happens because of the
index.js
L:131This will convert the
0
to empty string, so I am woundering is this a bug or not, if not, I think we should notice the user we should always put heString
type value.The text was updated successfully, but these errors were encountered: