@types/cookies

  • Version 0.7.7
  • Published
  • 9.03 kB
  • 4 dependencies
  • MIT license

Install

npm i @types/cookies
yarn add @types/cookies
pnpm add @types/cookies

Overview

TypeScript definitions for cookies

Index

Variables

variable Cookies

const Cookies: CookiesFunction;

    Interfaces

    interface Cookie {}

      property domain

      domain: string;

        property expires

        expires: Date;

          property httpOnly

          httpOnly: boolean;

            property maxage

            maxage: number;
            • "maxage" is deprecated, use "maxAge" instead

            property maxAge

            maxAge: number;

              property name

              name: string;

                property overwrite

                overwrite: boolean;

                  property path

                  path: string;

                    property sameSite

                    sameSite: boolean;

                      property secure

                      secure: boolean;

                        property value

                        value: string;

                          method toHeader

                          toHeader: () => string;

                            method toString

                            toString: () => string;

                              interface Cookies

                              interface Cookies {}

                                property request

                                request: IncomingMessage;

                                  property response

                                  response: ServerResponse;

                                    property secure

                                    secure: boolean;

                                      method get

                                      get: (name: string, opts?: Cookies.GetOption) => 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.

                                      method set

                                      set: (name: string, value?: string | null, opts?: Cookies.SetOption) => this;
                                      • 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.

                                      interface GetOption

                                      interface GetOption {}

                                        property signed

                                        signed: boolean;

                                          interface Option

                                          interface Option {}

                                            property keys

                                            keys?: string[] | Keygrip | undefined;

                                              property secure

                                              secure?: boolean | undefined;

                                                interface SetOption

                                                interface SetOption {}

                                                  property domain

                                                  domain?: string | undefined;
                                                  • a string indicating the domain of the cookie (no default).

                                                  property expires

                                                  expires?: Date | undefined;
                                                  • a Date object indicating the cookie's expiration date (expires at the end of session by default).

                                                  property httpOnly

                                                  httpOnly?: boolean | undefined;
                                                  • a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default).

                                                  property maxAge

                                                  maxAge?: number | undefined;
                                                  • a number representing the milliseconds from Date.now() for expiry

                                                  property overwrite

                                                  overwrite?: boolean | undefined;
                                                  • a boolean indicating whether to overwrite previously set cookies of the same name (false by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.

                                                  property path

                                                  path?: string | undefined;
                                                  • a string indicating the path of the cookie (/ by default).

                                                  property sameSite

                                                  sameSite?: 'strict' | 'lax' | 'none' | boolean | undefined;
                                                  • a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', or true (which maps to 'strict').

                                                  property secure

                                                  secure?: boolean | undefined;
                                                  • a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).

                                                  property secureProxy

                                                  secureProxy?: boolean | undefined;
                                                  • "secureProxy" option is deprecated; use "secure" option, provide "secure" to constructor if needed

                                                  property signed

                                                  signed?: boolean | undefined;
                                                  • a boolean indicating whether the cookie is to be signed (false by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.

                                                  Type Aliases

                                                  type CookieAttr

                                                  type CookieAttr = SetOption;

                                                    type ICookies

                                                    type ICookies = Cookies;
                                                    • for backward-compatibility

                                                    type IOptions

                                                    type IOptions = SetOption;
                                                    • for backward-compatibility

                                                    Package Files (1)

                                                    Dependencies (4)

                                                    Dev Dependencies (0)

                                                    No dev dependencies.

                                                    Peer Dependencies (0)

                                                    No peer dependencies.

                                                    Badge

                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/cookies.

                                                    • Markdown
                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/cookies)
                                                    • HTML
                                                      <a href="https://www.jsdocs.io/package/@types/cookies"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>