Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

set-cookie-parser

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-cookie-parser

Parses set-cookie headers into objects

  • 2.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.4M
increased by6.76%
Maintainers
1
Weekly downloads
 
Created

What is set-cookie-parser?

The set-cookie-parser package is a Node.js module that provides utilities for parsing and splitting the Set-Cookie headers found in HTTP responses. It can be used to extract cookie data in a structured format, making it easier to handle cookies in server-side applications.

What are set-cookie-parser's main functionalities?

Parse Set-Cookie Headers

This feature allows you to parse the Set-Cookie header from an HTTP response and convert it into an array of cookie objects.

const setCookie = require('set-cookie-parser');
const cookies = setCookie.parse(responseHeaders);
// responseHeaders should be the Set-Cookie header string or an array of Set-Cookie header strings.

Parse Set-Cookie Headers with options

This feature allows you to parse the Set-Cookie header with additional options, such as returning a map of cookies for easier access by cookie name.

const setCookie = require('set-cookie-parser');
const cookies = setCookie.parse(responseHeaders, { map: true });
// responseHeaders should be the Set-Cookie header string or an array of Set-Cookie header strings. The option { map: true } will return an object map of cookies instead of an array.

Split a Set-Cookie string

This feature allows you to split a Set-Cookie header string into an array of individual cookie strings, which can then be parsed separately.

const setCookie = require('set-cookie-parser');
const splitCookies = setCookie.splitCookiesString(cookieHeader);
// cookieHeader should be the full Set-Cookie header string.

Other packages similar to set-cookie-parser

Keywords

FAQs

Package last updated on 21 Oct 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc