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.0.5 to 1.0.6

6

CHANGELOG.md

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

## v1.0.5 (master)
## v1.0.6 (master)
- Fix: less greedy content-type charset matching
## v1.0.5
- Fix: when follow = 0, fetch should not follow redirect

@@ -12,0 +16,0 @@ - Enhance: update tests for better coverage

2

lib/response.js

@@ -118,3 +118,3 @@

if (this.headers.has('content-type')) {
res = /charset=(.*)/i.exec(this.headers.get('content-type'));
res = /charset=([^;]*)/i.exec(this.headers.get('content-type'));
}

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

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

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

@@ -142,2 +142,14 @@

if (p === '/encoding/order1') {
res.statusCode = 200;
res.setHeader('Content-Type', 'charset=gbk; text/plain');
res.end(convert('中文', 'gbk'));
}
if (p === '/encoding/order2') {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain; charset=gbk; qs=1');
res.end(convert('中文', 'gbk'));
}
if (p === '/redirect/301') {

@@ -144,0 +156,0 @@ res.statusCode = 301;

@@ -505,2 +505,22 @@

it('should support uncommon content-type order, charset in front', function() {
url = base + '/encoding/order1';
return fetch(url).then(function(res) {
expect(res.status).to.equal(200);
return res.text().then(function(result) {
expect(result).to.equal('中文');
});
});
});
it('should support uncommon content-type order, end with qs', function() {
url = base + '/encoding/order2';
return fetch(url).then(function(res) {
expect(res.status).to.equal(200);
return res.text().then(function(result) {
expect(result).to.equal('中文');
});
});
});
it('should allow piping response body as stream', function(done) {

@@ -507,0 +527,0 @@ url = base + '/hello';

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