@@ -10,9 +10,6 @@ if (common.hasCrypto) {
10
10
console . log ( '1..0 # Skipped: missing crypto' ) ;
11
11
}
12
12
13
- var expected_bad_requests = 0 ;
14
- var actual_bad_requests = 0 ;
15
-
16
13
var host = '********' ;
17
14
host += host ;
18
15
host += host ;
@@ -25,23 +22,20 @@ function do_not_call() {
25
22
}
26
23
27
24
function test ( mod ) {
28
- expected_bad_requests += 2 ;
29
25
30
26
// Bad host name should not throw an uncatchable exception.
31
27
// 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 ) {
34
30
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
38
33
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 ) {
41
36
assert . equal ( err . code , 'ENOTFOUND' ) ;
42
- actual_bad_requests ++ ;
43
- } ) ;
44
- req . end ( ) ;
37
+ } ) ) ;
38
+ req2 . end ( ) ;
45
39
}
46
40
47
41
if ( common . hasCrypto ) {
@@ -51,7 +45,3 @@ if (common.hasCrypto) {
51
45
}
52
46
53
47
test ( http ) ;
54
-
55
- process . on ( 'exit' , function ( ) {
56
- assert . equal ( actual_bad_requests , expected_bad_requests ) ;
57
- } ) ;
0 commit comments