Socket
Socket
Sign inDemoInstall

@adobe/fetch

Package Overview
Dependencies
Maintainers
21
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/fetch - npm Package Compare versions

Comparing version 3.1.4 to 3.2.0

6

package.json
{
"name": "@adobe/fetch",
"version": "3.1.4",
"version": "3.2.0",
"description": "Light-weight Fetch implementation transparently supporting both HTTP/1(.1) and HTTP/2",

@@ -64,3 +64,3 @@ "main": "src/index.js",

"chai-iterator": "3.0.2",
"eslint": "8.23.1",
"eslint": "8.25.0",
"eslint-config-airbnb-base": "15.0.0",

@@ -79,3 +79,3 @@ "eslint-plugin-header": "3.1.1",

"semantic-release": "19.0.5",
"sinon": "14.0.0",
"sinon": "14.0.1",
"stream-buffers": "3.0.2"

@@ -82,0 +82,0 @@ },

@@ -40,2 +40,3 @@ <div align="center">

- [HTTP/1.1 Keep-Alive](#http11-keep-alive)
- [Extract Set-Cookie Header](#extract-set-cookie-header)
- [Self-signed Certificates](#self-signed-certificates)

@@ -459,2 +460,14 @@ - [Set cache size limit](#set-cache-size-limit)

### Extract Set-Cookie Header
Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.plain()`. This is an `@adobe/fetch` only API.
```javascript
const { fetch } = require('@adobe/fetch');
const resp = await fetch('https://httpbin.org/cookies/set?a=1&b=2');
// returns an array of values, instead of a string of comma-separated values
console.log(resp.headers.plain()['set-cookie']);
```
### Self-signed Certificates

@@ -461,0 +474,0 @@

@@ -82,7 +82,21 @@ /*

init.forEach(([name, value]) => {
this.append(name, value);
if (Array.isArray(value)) {
// special case for Set-Cookie header which can have an array of values
value.forEach((val) => {
this.append(name, val);
});
} else {
this.append(name, value);
}
});
} else /* istanbul ignore else */ if (isPlainObject(init)) {
for (const [name, value] of Object.entries(init)) {
this.append(name, value);
if (Array.isArray(value)) {
// special case for Set-Cookie header which can have an array of values
value.forEach((val) => {
this.append(name, val);
});
} else {
this.set(name, value);
}
}

@@ -102,3 +116,9 @@ }

const val = this[INTERNALS].map.get(normalizeName(name));
return val === undefined ? null : val;
if (val === undefined) {
return null;
} else if (Array.isArray(val)) {
return val.join(', ');
} else {
return val;
}
}

@@ -110,3 +130,9 @@

const oldVal = this[INTERNALS].map.get(nm);
this[INTERNALS].map.set(nm, oldVal ? `${oldVal}, ${val}` : val);
if (Array.isArray(oldVal)) {
oldVal.push(val);
} else if (oldVal === undefined) {
this[INTERNALS].map.set(nm, val);
} else {
this[INTERNALS].map.set(nm, [oldVal, val]);
}
}

@@ -113,0 +139,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