Skip to content

Commit 32349a7

Browse files
committed
test: Fix invalid end event handler on https.get() return
There are not many cases where this is actually reachable, which is why the existing code worked fine. For example, if we change one of the URLs to be a 404 error, it gets handled in the `handleResponse` callback by the status code condition. Change this to an `error` handler instead, as per the Node.js docs [1]. This can happen for DNS/TCP errors, or internal HTTP response parsing. Thanks @emarteca! [1] https://nodejs.org/api/http.html#httprequesturl-options-callback Fixes #80.
1 parent 441b125 commit 32349a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/bench.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function fetch( url ) {
7070
res.on( 'end', function () {
7171
resolve( data );
7272
} );
73-
} ).on( 'end', function ( err ) {
73+
} ).on( 'error', function ( err ) {
7474
reject( err );
7575
} );
7676
} );

0 commit comments

Comments
 (0)