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.0 to 1.1.1

6

CHANGELOG.md

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

## v1.1.0 (master)
## v1.1.1 (master)
- Enhance: now req.headers accept both plain object and `Headers` instance
## v1.1.0
- Enhance: timeout now also applies to response body (in case of slow response)

@@ -12,0 +16,0 @@ - Fix: timeout is now cleared properly when fetch is done/has failed

@@ -21,2 +21,8 @@

// Headers
if (headers instanceof Headers) {
headers = headers.raw();
}
// plain object
for (var prop in headers) {

@@ -23,0 +29,0 @@ if (!headers.hasOwnProperty(prop)) {

2

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

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

@@ -145,2 +145,14 @@

it('should accept headers instance', function() {
url = base + '/inspect';
opts = {
headers: new Headers({ 'x-custom-header': 'abc' })
};
return fetch(url, opts).then(function(res) {
return res.json();
}).then(function(res) {
expect(res.headers['x-custom-header']).to.equal('abc');
});
});
it('should follow redirect code 301', function() {

@@ -211,2 +223,15 @@ url = base + '/redirect/301';

it('should follow redirect code 301 and keep existing headers', function() {
url = base + '/redirect/301';
opts = {
headers: new Headers({ 'x-custom-header': 'abc' })
};
return fetch(url, opts).then(function(res) {
expect(res.url).to.equal(base + '/inspect');
return res.json();
}).then(function(res) {
expect(res.headers['x-custom-header']).to.equal('abc');
});
});
it('should reject broken redirect', function() {

@@ -614,2 +639,26 @@ url = base + '/error/redirect';

it('should wrap headers', function() {
var h1 = new Headers({
a: '1'
});
var h2 = new Headers(h1);
h2.set('b', '1');
var h3 = new Headers(h2);
h3.append('a', '2');
expect(h1._headers['a']).to.include('1');
expect(h1._headers['a']).to.not.include('2');
expect(h1._headers['b']).to.not.include('1');
expect(h2._headers['a']).to.include('1');
expect(h2._headers['a']).to.not.include('2');
expect(h2._headers['b']).to.include('1');
expect(h3._headers['a']).to.include('1');
expect(h3._headers['a']).to.include('2');
expect(h3._headers['b']).to.include('1');
});
it('should support https request', function() {

@@ -626,2 +675,3 @@ this.timeout(5000);

});
});
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