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 - npm Package Compare versions

Comparing version 2.4.7 to 2.4.8

4

lib/set-cookie.js

@@ -27,3 +27,5 @@ "use strict";

console.error(
`set-cookie-parser encountered an error while decoding a cookie with value '${value}'. Set options.decodeValues to false to disable this feature.`,
"set-cookie-parser encountered an error while decoding a cookie with value '" +
value +
"'. Set options.decodeValues to false to disable this feature.",
e

@@ -30,0 +32,0 @@ );

{
"name": "set-cookie-parser",
"version": "2.4.7",
"version": "2.4.8",
"description": "Parses set-cookie headers into objects",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/nfriedly/set-cookie-parser",

@@ -119,2 +119,26 @@ # set-cookie-parser

### Creating a new, modified set-cookie header
This library can be used in conjunction with the [cookie](https://www.npmjs.com/package/cookie) library to modify and replace set-cookie headers:
```js
const libCookie = require('cookie');
const setCookie = require('set-cookie-parser');
function modifySetCookie(res){
// parse the set-cookie headers with this library
let cookies = setCookie.parse(res);
// modify the cookies here
// ...
// create new set-cookie headers using the cookie library
res.headers['set-cookie'] = cookies.map(function(cookie) {
return libCookie.serialize(cookie.name, cookie.value, cookie);
});
}
```
See a real-world example of this in [unblocker](https://github.com/nfriedly/node-unblocker/blob/a894c0861af26489d2467c94fbc500770f57464f/lib/cookies.js#L62-L76)
## Usage in React Native

@@ -121,0 +145,0 @@

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