🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

set-cookie-parser

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
s

set-cookie-parser

Parses set-cookie headers into objects

2.7.1
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

78

Maintenance

100

License

Version published
Weekly downloads
8.9M
4.43%
Maintainers
1
Weekly downloads
 
Created
Issues
2

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

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