-
Notifications
You must be signed in to change notification settings - Fork 592
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
BREAKING(http): cookie headers as params #1041
BREAKING(http): cookie headers as params #1041
Conversation
http/cookie.ts
Outdated
@@ -164,8 +164,8 @@ function validateDomain(domain: string): void { | |||
* Parse the cookies of the Server Request | |||
* @param req An object which has a `headers` property |
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.
* @param req An object which has a `headers` property | |
* @param {Headers} headers The headers instance to get cookies from. |
Need to take care to keep the jsdocs in line with changes 🙂
Sim. applies to other method interface changes.
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.
By way of "improve what you touch", consider also adding the @return {Object} …
jsdoc for these methods as well to add clarity to what is returned for users of the Deno docs.
http/cookie.ts
Outdated
@@ -195,16 +196,13 @@ export function getCookies(req: { headers: Headers }): Record<string, string> { | |||
* httpOnly: true, secure: true, maxAge: 2, domain: "deno.land" }); |
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.
See also the @param
definitions for this method.
http/cookie.ts
Outdated
@@ -219,11 +217,11 @@ export function setCookie(res: { headers?: Headers }, cookie: Cookie): void { | |||
* deleteCookie(res,'foo', {domain:'deno.land'}); |
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.
Sim.
@cmorten
Probably best to open a separate PR for this. |
Only what is currently in https://deno.land/manual/contributing/style_guide#use-jsdoc-for-exported-symbols, though not sure it’s been kept to strictly.
I think the singular simply because that is what doc.deno seems to support with syntax highlighting.
I believe
We should make sure the jsdocs are at least consistent with the implementation, anything more perhaps could be raised as a separate issue and PR. |
@cmorten I updated readme and jsdoc and tests pass now. |
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 think this now makes sense because we switch to the new http/server module.
@timreichen Thank your for your suggestion and contribution!
Thanks @cmorten for reviewing.
Change cookie functions
getCookies
,setCookie
anddeleteCookie
params toHeaders
instance instead of object with (optional)Headers
instance property.The former param was so a response can directly be passed. Since the functions only require a
Headers
instance to manipulate, that should be passed directly.before
after
If any of the functions wanted to be used on a
Headers
instance directly, it had to be wrapped:before
after
Since the
headers
property insetCookie
was optional, this allowed to pass an empty object in which aheaders
property would be initiated, manipulated, which seems avoidable.before
after
not possible