mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-13 15:09:25 +00:00
Extend supported Node.js from <=9 to <=14
This commit is contained in:
@@ -6,6 +6,11 @@ node_js:
|
||||
- 7
|
||||
- 8
|
||||
- 9
|
||||
- 11
|
||||
- 12
|
||||
- 13
|
||||
- 13
|
||||
- 14
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run test
|
||||
|
||||
@@ -413,6 +413,11 @@ exports.createServer = function createServer(options) {
|
||||
// This could happen when a protocol error occurs when an error occurs
|
||||
// after the headers have been received (and forwarded). Do not write
|
||||
// the headers because it would generate an error.
|
||||
// Prior to Node 13.x, the stream would have ended.
|
||||
// As of Node 13.x, we must explicitly close it.
|
||||
if (res.writableEnded === false) {
|
||||
res.end();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -385,10 +385,15 @@ describe('Proxy errors', function() {
|
||||
});
|
||||
|
||||
it('Content-Length mismatch', function(done) {
|
||||
var errorMessage = 'Error: Parse Error: Invalid character in Content-Length';
|
||||
// <13.0.0: https://github.com/nodejs/node/commit/ba565a37349e81c9d2402b0c8ef05ab39dca8968
|
||||
if (parseInt(process.versions.node, 10) < 13) {
|
||||
errorMessage = 'Error: Parse Error';
|
||||
}
|
||||
request(cors_anywhere)
|
||||
.get('/' + bad_http_server_url)
|
||||
.expect('Access-Control-Allow-Origin', '*')
|
||||
.expect(404, 'Not found because of proxy error: Error: Parse Error', done);
|
||||
.expect(404, 'Not found because of proxy error: ' + errorMessage, done);
|
||||
});
|
||||
|
||||
it('Invalid HTTP status code', function(done) {
|
||||
|
||||
Reference in New Issue
Block a user