File tree 1 file changed +5
-17
lines changed
1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change 20
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
22
22
'use strict' ;
23
- require ( '../common' ) ;
24
- const assert = require ( 'assert' ) ;
25
-
23
+ const common = require ( '../common' ) ;
26
24
const http = require ( 'http' ) ;
27
25
28
- let serverRequests = 0 ;
29
- let clientRequests = 0 ;
30
-
31
- const server = http . createServer ( function ( req , res ) {
32
- serverRequests ++ ;
26
+ const server = http . createServer ( common . mustCall ( function ( req , res ) {
33
27
res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } ) ;
34
28
res . end ( 'OK' ) ;
35
- } ) ;
29
+ } ) ) ;
36
30
37
31
server . listen ( 0 , function ( ) {
38
32
function callback ( ) { }
@@ -44,10 +38,9 @@ server.listen(0, function() {
44
38
} , function ( res ) {
45
39
req . clearTimeout ( callback ) ;
46
40
47
- res . on ( 'end' , function ( ) {
48
- clientRequests ++ ;
41
+ res . on ( 'end' , common . mustCall ( function ( ) {
49
42
server . close ( ) ;
50
- } ) ;
43
+ } ) ) ;
51
44
52
45
res . resume ( ) ;
53
46
} ) ;
@@ -56,8 +49,3 @@ server.listen(0, function() {
56
49
req . setTimeout ( 0xffffffff , callback ) ;
57
50
req . end ( ) ;
58
51
} ) ;
59
-
60
- process . once ( 'exit' , function ( ) {
61
- assert . strictEqual ( clientRequests , 1 ) ;
62
- assert . strictEqual ( serverRequests , 1 ) ;
63
- } ) ;
You can’t perform that action at this time.
0 commit comments