-
Notifications
You must be signed in to change notification settings - Fork 0
Cookies
Anton edited this page Dec 18, 2019
·
8 revisions
The default export of the package, Cookies implements the constructor and the methods to get and set cookies.
Cookies
: The interface for Cookies: signed and unsigned cookies based on Keygrip.
Name | Type & Description |
---|---|
keys | !Keygrip |
The keys object constructed from passed keys (private, will be installed from options). | |
secure | boolean |
Explicitly specifies if the connection is secure (private, will be installed from options). | |
get | (name: string, opts: { signed: boolean }) => (string | undefined) |
This extracts the cookie with the given name from the Cookie header in the request. If such a cookie exists, its value is returned. Otherwise, nothing is returned. { signed: true } can optionally be passed as the second parameter options. In this case, a signature cookie (a cookie of same name ending with the .sig suffix appended) is fetched. If no such cookie exists, nothing is returned. If the signature cookie does exist, the provided Keygrip object is used to check whether the hash of cookie-name=cookie-value matches that of any registered key:
|
|
set | (name: string, value?: ?string, attributes?: !CookieAttributes) => void |
This sets the given cookie in the response and returns the current context to allow chaining. If the value is omitted, an outbound header with an expired date is used to delete the cookie. |
![]() |
© Art Deco for Idio 2019 |
|
![]() |
Tech Nation Visa Sucks |
---|