22require ( '../common' ) ;
33const assert = require ( 'assert' ) ;
44const http = require ( 'http' ) ;
5+ const debug = require ( 'util' ) . debuglog ( 'test' ) ;
56
67const testResBody = 'other stuff!\n' ;
78const kMessageCount = 2 ;
89
910const server = http . createServer ( ( req , res ) => {
1011 for ( let i = 0 ; i < kMessageCount ; i ++ ) {
11- console . error ( `Server sending informational message #${ i } ...` ) ;
12+ debug ( `Server sending informational message #${ i } ...` ) ;
1213 res . writeProcessing ( ) ;
1314 }
14- console . error ( 'Server sending full response...' ) ;
15+ debug ( 'Server sending full response...' ) ;
1516 res . writeHead ( 200 , {
1617 'Content-Type' : 'text/plain' ,
1718 'ABCD' : '1'
@@ -25,7 +26,7 @@ server.listen(0, function() {
2526 path : '/world'
2627 } ) ;
2728 req . end ( ) ;
28- console . error ( 'Client sending request...' ) ;
29+ debug ( 'Client sending request...' ) ;
2930
3031 let body = '' ;
3132 let infoCount = 0 ;
@@ -40,7 +41,7 @@ server.listen(0, function() {
4041 res . setEncoding ( 'utf8' ) ;
4142 res . on ( 'data' , function ( chunk ) { body += chunk ; } ) ;
4243 res . on ( 'end' , function ( ) {
43- console . error ( 'Got full response.' ) ;
44+ debug ( 'Got full response.' ) ;
4445 assert . strictEqual ( body , testResBody ) ;
4546 assert . ok ( 'abcd' in res . headers ) ;
4647 server . close ( ) ;
0 commit comments