Socket
Socket
Sign inDemoInstall

set-cookie-header

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-cookie-header

Decode and encode Set-Cookie headers


Version published
Maintainers
1
Weekly downloads
33

Weekly downloads

Readme

Source

Decode and encode Set-Cookie headers. Aligns with RFC6265.

Install

npm install set-cookie-header

Quick Start

import {encode, decode} from 'set-cookie-header';

const cookies = decode('foo=bar; Max-Age=1234; Domain=.example.com; Path=/; Expires=December 17, 1995 03:24:00 GMT; HttpOnly');

for (const cookie of cookies) {
  cookie.secure = true;
  const encoded = encoded(cookie);
}

API

Accepts:

  • cookieHeader can be a raw Set-Cookie header, the value of the header, or an array of header values.
  • Eg:
    • 'Set-Cookie: foo=bar; Path=/'
    • 'foo=bar; Secure'
    • ['foo=bar', 'biz=baz']

Returns:

  • Array of decoded Cookie objects.

Accepts:

  • An array or a single Cookie object.

Returns:

  • Array of encoded cookie strings.

Keywords

FAQs

Last updated on 08 Oct 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc