File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22const common = require ( '../common' ) ;
3- const assert = require ( 'assert' ) ;
43const http = require ( 'http' ) ;
54
6- var options = {
5+ const options = {
76 method : 'GET' ,
87 port : undefined ,
98 host : '127.0.0.1' ,
109 path : '/'
1110} ;
1211
13- var server = http . createServer ( ) ;
12+ const server = http . createServer ( ) ;
1413
1514server . listen ( 0 , options . host , function ( ) {
1615 options . port = this . address ( ) . port ;
17- var req = http . request ( options ) ;
16+ const req = http . request ( options ) ;
1817 req . on ( 'error' , function ( ) {
1918 // this space is intentionally left blank
2019 } ) ;
2120 req . on ( 'close' , common . mustCall ( ( ) => server . close ( ) ) ) ;
2221
23- var timeout_events = 0 ;
2422 req . setTimeout ( 1 ) ;
25- req . on ( 'timeout' , common . mustCall ( ( ) => timeout_events += 1 ) ) ;
26- setTimeout ( function ( ) {
27- req . destroy ( ) ;
28- assert . strictEqual ( timeout_events , 1 ) ;
29- } , common . platformTimeout ( 100 ) ) ;
30- setTimeout ( function ( ) {
31- req . end ( ) ;
32- } , common . platformTimeout ( 50 ) ) ;
23+ req . on ( 'timeout' , common . mustCall ( ( ) => {
24+ req . end ( ( ) => {
25+ setTimeout ( ( ) => {
26+ req . destroy ( ) ;
27+ } , 100 ) ;
28+ } ) ;
29+ } ) ) ;
3330} ) ;
You can’t perform that action at this time.
0 commit comments