node-fetch
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -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 |
@@ -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'; |
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
40639
1102
66