theodorejb / es-cookie

A simple, lightweight module for handling cookies
MIT License
45 stars 2 forks source link

Unable to read cookie value if cookie name has a dot #4

Closed burtek closed 6 years ago

burtek commented 6 years ago

This one works:

const cookies = Cookies.getAll();
const access_token = cookies['test.AuthCookie'];

This one doesn't:

const access_token = Cookies.get('test.AuthCookie'); // => undefined
theodorejb commented 6 years ago

I added a test for cookie names containing a period, and it successfully passes in the latest version of Firefox, Chrome, Edge, and Internet Explorer. It should be impossible for your first code block to work but the second to fail, since the get function just takes a name parameter and executes the following line:

return getAll()[name];
burtek commented 6 years ago

It works now. Either some edge-case or mis-implementation. Thanks anyway