Skip to content

set function breaks session cookie #2

@egtoney

Description

@egtoney

The following code is causing all of the cookie parameters to be removed from the Set-Cookie header when the cookie is initially set by express-sessions.

if(session.cookie && session.cookie.toJSON) {
session.cookie = session.cookie.toJSON();
}

By turning the cookie object into a normal JSON object all of the computed properties on the object are lost. This causes an issue in express-sessions since it uses the computed data property to fill in the Set-Cookie header.

Ref: the data property

https://github.com/expressjs/session/blob/e18fb51d2d403bf3b5bd4e498f621dee4a52db41/session/cookie.js#L117-L127

Ref: where the data property is being used

https://github.com/expressjs/session/blob/e18fb51d2d403bf3b5bd4e498f621dee4a52db41/index.js#L243

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions