Skip to content

setCookie on the same key multiple times is not deduped #4445

@NamesMT

Description

@NamesMT

What version of Hono are you using?

4.9.10

What runtime/platform is your app running on? (with version if possible)

What steps can reproduce the bug?

simply call setCookie with the same key multiple times, e.g.:

setCookie(c, 'hello', 'world1')
setCookie(c, 'hello', 'world2')
setCookie(c, 'hello', 'world3')

What is the expected behavior?

Only the last call's data is sent, i.e.:

set-cookie:
hello=world3; Path=/

What do you see instead?

set-cookie:
hello=world1; Path=/
set-cookie:
hello=world2; Path=/
set-cookie:
hello=world3; Path=/

The response includes multiple Set-Cookie header for the same key, wasting unnecessary bandwidth and possibly prone to error with the receiving client's parser.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions