Extend supported Node.js from <=9 to <=14

This commit is contained in:
Rob Wu
2020-05-02 16:45:42 +02:00
parent 4814647a9d
commit 7222fce684
3 changed files with 16 additions and 1 deletions

View File

@@ -6,6 +6,11 @@ node_js:
- 7
- 8
- 9
- 11
- 12
- 13
- 13
- 14
script:
- npm run lint
- npm run test

View File

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

View File

@@ -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) {