Skip to content

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

@konomae

Description

@konomae

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions