@@ -10,9 +10,6 @@ if (common.hasCrypto) {
1010 console . log ( '1..0 # Skipped: missing crypto' ) ;
1111}
1212
13- var expected_bad_requests = 0 ;
14- var actual_bad_requests = 0 ;
15-
1613var host = '********' ;
1714host += host ;
1815host += host ;
@@ -25,23 +22,20 @@ function do_not_call() {
2522}
2623
2724function test ( mod ) {
28- expected_bad_requests += 2 ;
2925
3026 // Bad host name should not throw an uncatchable exception.
3127 // Ensure that there is time to attach an error listener.
32- var req = mod . get ( { host : host , port : 42 } , do_not_call ) ;
33- req . on ( 'error' , function ( err ) {
28+ var req1 = mod . get ( { host : host , port : 42 } , do_not_call ) ;
29+ req1 . on ( 'error' , common . mustCall ( function ( err ) {
3430 assert . equal ( err . code , 'ENOTFOUND' ) ;
35- actual_bad_requests ++ ;
36- } ) ;
37- // http.get() called req.end() for us
31+ } ) ) ;
32+ // http.get() called req1.end() for us
3833
39- var req = mod . request ( { method : 'GET' , host : host , port : 42 } , do_not_call ) ;
40- req . on ( 'error' , function ( err ) {
34+ var req2 = mod . request ( { method : 'GET' , host : host , port : 42 } , do_not_call ) ;
35+ req2 . on ( 'error' , common . mustCall ( function ( err ) {
4136 assert . equal ( err . code , 'ENOTFOUND' ) ;
42- actual_bad_requests ++ ;
43- } ) ;
44- req . end ( ) ;
37+ } ) ) ;
38+ req2 . end ( ) ;
4539}
4640
4741if ( common . hasCrypto ) {
@@ -51,7 +45,3 @@ if (common.hasCrypto) {
5145}
5246
5347test ( http ) ;
54-
55- process . on ( 'exit' , function ( ) {
56- assert . equal ( actual_bad_requests , expected_bad_requests ) ;
57- } ) ;
0 commit comments