Setu-TS
    Preparing search index...

    Function serializeCookie

    • Serializes a cookie into a Set-Cookie header value.

      The value is percent-encoded, so a payload containing ;, ,, or whitespace can neither inject attributes nor split the header.

      Parameters

      • name: string

        Cookie name; must match RFC 6265's token production

      • value: string

        Cookie value; percent-encoded on the way out

      • attrs: CookieAttributes = {}

        Attributes to emit; omitted fields emit no attribute

      Returns string

      The Set-Cookie header value

      If name is not a valid cookie name, or maxAge is not an integer

      serializeCookie('sid', 'abc', { path: '/', httpOnly: true, sameSite: 'lax', maxAge: 3600 });
      // → 'sid=abc; Max-Age=3600; Path=/; HttpOnly; SameSite=Lax'

      0.2.0