Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sometimes $cookies.set is not consistent with `document.cookie=`

See original GitHub issue

Issue Description

When we use document.cookie='', the value of document.cookie is; But when we use this.$cookies.set('email', ''), the value of document.cookie is

It’s ok when we just use cookie in front-end, but the back-end will get an inconsistent cookie value when we use vue-cookies to replace document.cookie= in front-end, it would cause the back-end to upgrade their code.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

Connor1stcommented, Dec 27, 2020

I agree with @lifubang in that I am having issues with this as well.

I don’t mind if the value is encoded in the cookie storage, but the decode does not work for me when I get cookies back. When I use Vue.$cookies.get() it returns the escaped strings for me, so the functionality is ruined.

My understanding is that the cookie stores a standard string and handles all required escaping itself as well.

liuyang92commented, Feb 16, 2022

当cookie含有 ASCII 特殊符号时,encodeURIComponent会对key or value 进行编码,这样会导致接下来的请求后端cookies校验无法通过,希望不要对@&=+$#这些特殊符号进行编译。

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why would setting document.cookie not work in Chrome?
The way cookies work, at least in Chrome, is a bit weird. If you need to change a cookie's value, then you need...
Read more >
Document.cookie - Web APIs | MDN
The Document property cookie lets you read and write cookies associated with the document. It serves as a getter and setter for the...
Read more >
Cookies, document.cookie - The Modern JavaScript Tutorial
A write operation to document.cookie updates only cookies mentioned in it, but doesn't touch other cookies. For instance, this call sets a ...
Read more >
setcookie - Manual - PHP
It seems the IE (6, 7, 8 and 9) do not accept the part 'Expire=0' when setting a session cookie. To fix it...
Read more >
Upcoming changes in cookie handling in Google Chrome
If your application is used in cross-site scenarios and it sets cookies using the platform's JavaScript extensibility (i.e. you're setting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found