-
Notifications
You must be signed in to change notification settings - Fork 49
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
Easy cookie #72
Conversation
There was a problem hiding this 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/response.js
Outdated
@@ -127,6 +129,10 @@ function generatePayload (response) { | |||
return JSON.parse(this.payload) | |||
} | |||
|
|||
res.cookies = function parseCookies () { | |||
return setCookie.parse(this) | |||
} |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
light-my-request/lib/response.js
Line 47 in 7acd544
util.inherits(Response, http.ServerResponse) |
Gotcha for the getter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this 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.
Good point, but I found this messge by the creator of |
@Eomm would you mind to send a PR to update the fastify docs? |
closes #71