File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ node_js:
66 - 7
77 - 8
88 - 9
9+ - 11
10+ - 12
11+ - 13
12+ - 13
13+ - 14
914script :
1015 - npm run lint
1116 - npm run test
Original file line number Diff line number Diff line change @@ -413,6 +413,11 @@ exports.createServer = function createServer(options) {
413413 // This could happen when a protocol error occurs when an error occurs
414414 // after the headers have been received (and forwarded). Do not write
415415 // the headers because it would generate an error.
416+ // Prior to Node 13.x, the stream would have ended.
417+ // As of Node 13.x, we must explicitly close it.
418+ if ( res . writableEnded === false ) {
419+ res . end ( ) ;
420+ }
416421 return ;
417422 }
418423
Original file line number Diff line number Diff line change @@ -385,10 +385,15 @@ describe('Proxy errors', function() {
385385 } ) ;
386386
387387 it ( 'Content-Length mismatch' , function ( done ) {
388+ var errorMessage = 'Error: Parse Error: Invalid character in Content-Length' ;
389+ // <13.0.0: https://github.com/nodejs/node/commit/ba565a37349e81c9d2402b0c8ef05ab39dca8968
390+ if ( parseInt ( process . versions . node , 10 ) < 13 ) {
391+ errorMessage = 'Error: Parse Error' ;
392+ }
388393 request ( cors_anywhere )
389394 . get ( '/' + bad_http_server_url )
390395 . expect ( 'Access-Control-Allow-Origin' , '*' )
391- . expect ( 404 , 'Not found because of proxy error: Error: Parse Error' , done ) ;
396+ . expect ( 404 , 'Not found because of proxy error: ' + errorMessage , done ) ;
392397 } ) ;
393398
394399 it ( 'Invalid HTTP status code' , function ( done ) {
You can’t perform that action at this time.
0 commit comments