Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookies: Decoding of spaces that are encoded as + #902

Open
konomae opened this issue Jun 13, 2024 · 1 comment
Open

cookies: Decoding of spaces that are encoded as + #902

konomae opened this issue Jun 13, 2024 · 1 comment

Comments

@konomae
Copy link
Contributor

konomae commented Jun 13, 2024

Bug Report

I'm not sure if this is a bug or a specification of @edge-runtime/cookies.
If a cookie contains spaces, they may be encoded as a + sign. (e.g: Rails)

Current Behavior:

const headers = new Headers({ cookie: 'a=hello+world' })
const cookies = new RequestCookies(headers)
const cookie = cookies.get('a')
expect(cookie).toEqual({ name: 'a', value: 'hello+world' })

Expected behavior/code

const headers = new Headers({ cookie: 'a=hello+world' })
const cookies = new RequestCookies(headers)
const cookie = cookies.get('a')
expect(cookie).toEqual({ name: 'a', value: 'hello world' })

Possible solution

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#decoding_query_parameters_from_a_url

Additional context/screenshots

N/A

@konomae
Copy link
Contributor Author

konomae commented Jun 13, 2024

BTY, CookieStore API returns raw values?

screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant