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

Easy cookie #72

Merged
merged 6 commits into from
Jan 5, 2020
Merged

Easy cookie #72

merged 6 commits into from
Jan 5, 2020

Conversation

Eomm
Copy link
Member

@Eomm Eomm commented Jan 3, 2020

closes #71

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, I’ve left a few notes

lib/request.js Outdated Show resolved Hide resolved
lib/response.js Outdated
@@ -127,6 +129,10 @@ function generatePayload (response) {
return JSON.parse(this.payload)
}

res.cookies = function parseCookies () {
return setCookie.parse(this)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a getter instead. I would also create a new class that inherits from ServerResponse with it. (use util.inherits, not class).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not the inherit already done here?

util.inherits(Response, http.ServerResponse)

Gotcha for the getter

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just a note, why the two dependencies? cookie should have all we need.

@Eomm
Copy link
Member Author

Eomm commented Jan 5, 2020

Good point, but I found this messge by the creator of cookie that says that the module's parse function is only designed to parse the Cookie header, not the Set-Cookie header.

@Eomm Eomm merged commit c568e9c into master Jan 5, 2020
@Eomm Eomm deleted the easy-cookie branch January 5, 2020 21:23
@mcollina
Copy link
Member

mcollina commented Jan 7, 2020

@Eomm would you mind to send a PR to update the fastify docs?

@Eomm Eomm mentioned this pull request Jan 7, 2020
4 tasks
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

Successfully merging this pull request may close these issues.

inject cookie
3 participants