Skip to content

Cookie value cuts at = sign #1570

@rijenkii

Description

@rijenkii

Describe the bug
Cookie values can contain = symbols. Browsers allow them, happy-dom only saves the part before the first =.

To Reproduce
Steps to reproduce the behavior:

rijenkii@rijenkiipc /t/hd
> npm install happy-dom

added 4 packages in 1s

1 package is looking for funding
  run `npm fund` for details
rijenkii@rijenkiipc /t/hd
> node
Welcome to Node.js v20.18.0.
Type ".help" for more information.
> const document = new (require("happy-dom")).Window().document;
undefined
> document.cookie = "hello=beautiful=world"
'hello=beautiful=world'
> document.cookie
'hello=beautiful'

Expected behavior
Expected the whole cookie to be saved.

Additional context

const [key, value] = parts.shift().split('=');

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions