Socket
Socket
Sign inDemoInstall

node-fetch

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fetch - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

6

CHANGELOG.md

@@ -8,4 +8,8 @@

## v1.1.1 (master)
## v1.1.2 (master)
- Fix: `Headers` should only support `String` and `Array` properties, and ignore others
## v1.1.1
- Enhance: now req.headers accept both plain object and `Headers` instance

@@ -12,0 +16,0 @@

2

lib/headers.js

@@ -34,3 +34,3 @@

this.set(prop, headers[prop]);
} else if (headers[prop].length > 0) {
} else if (headers[prop] instanceof Array) {
headers[prop].forEach(function(item) {

@@ -37,0 +37,0 @@ self.append(prop, item);

{
"name": "node-fetch",
"version": "1.1.1",
"version": "1.1.2",
"description": "A light-weight module that brings window.fetch to node.js and io.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -623,14 +623,35 @@

it('should skip prototype when reading response headers', function() {
it('should ignore unsupported attributes while reading headers', function() {
var FakeHeader = function() {};
FakeHeader.prototype.c = 'string';
FakeHeader.prototype.d = [1,2,3,4];
FakeHeader.prototype.z = 'string';
var res = new FakeHeader;
res.a = 'string';
res.b = [];
res.b = ['1','2'];
res.c = '';
res.d = [];
res.e = { a:1 };
res.f = 1;
res.g = undefined;
res.h = null;
res.i = NaN;
res.j = true;
res.k = false;
var headers = new Headers(res);
expect(headers._headers['a']).to.include('string');
expect(headers._headers['b']).to.be.undefined;
expect(headers._headers['c']).to.be.undefined;
expect(headers._headers['b']).to.include('1');
expect(headers._headers['b']).to.include('2');
expect(headers._headers['c']).to.include('');
expect(headers._headers['d']).to.be.undefined;
expect(headers._headers['e']).to.be.undefined;
expect(headers._headers['f']).to.be.undefined;
expect(headers._headers['g']).to.be.undefined;
expect(headers._headers['h']).to.be.undefined;
expect(headers._headers['i']).to.be.undefined;
expect(headers._headers['j']).to.be.undefined;
expect(headers._headers['k']).to.be.undefined;
expect(headers._headers['z']).to.be.undefined;
});

@@ -637,0 +658,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