node-fetch
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -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 @@ |
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44645
1221