11'use strict' ;
22require ( '../common' ) ;
3- var assert = require ( 'assert' ) ;
4- var http = require ( 'http' ) ;
5- var url = require ( 'url' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const http = require ( 'http' ) ;
5+ const url = require ( 'url' ) ;
66
77var responses_sent = 0 ;
88var responses_recvd = 0 ;
99var body0 = '' ;
1010var body1 = '' ;
1111
12- var server = http . Server ( function ( req , res ) {
13- if ( responses_sent == 0 ) {
14- assert . equal ( 'GET' , req . method ) ;
15- assert . equal ( '/hello' , url . parse ( req . url ) . pathname ) ;
12+ const server = http . Server ( function ( req , res ) {
13+ if ( responses_sent === 0 ) {
14+ assert . strictEqual ( 'GET' , req . method ) ;
15+ assert . strictEqual ( '/hello' , url . parse ( req . url ) . pathname ) ;
1616
1717 console . dir ( req . headers ) ;
18- assert . equal ( true , 'accept' in req . headers ) ;
19- assert . equal ( '*/*' , req . headers [ 'accept' ] ) ;
18+ assert . strictEqual ( true , 'accept' in req . headers ) ;
19+ assert . strictEqual ( '*/*' , req . headers [ 'accept' ] ) ;
2020
21- assert . equal ( true , 'foo' in req . headers ) ;
22- assert . equal ( 'bar' , req . headers [ 'foo' ] ) ;
21+ assert . strictEqual ( true , 'foo' in req . headers ) ;
22+ assert . strictEqual ( 'bar' , req . headers [ 'foo' ] ) ;
2323 }
2424
25- if ( responses_sent == 1 ) {
26- assert . equal ( 'POST' , req . method ) ;
27- assert . equal ( '/world' , url . parse ( req . url ) . pathname ) ;
25+ if ( responses_sent === 1 ) {
26+ assert . strictEqual ( 'POST' , req . method ) ;
27+ assert . strictEqual ( '/world' , url . parse ( req . url ) . pathname ) ;
2828 this . close ( ) ;
2929 }
3030
@@ -41,28 +41,28 @@ var server = http.Server(function(req, res) {
4141server . listen ( 0 ) ;
4242
4343server . on ( 'listening' , function ( ) {
44- var agent = new http . Agent ( { port : this . address ( ) . port , maxSockets : 1 } ) ;
44+ const agent = new http . Agent ( { port : this . address ( ) . port , maxSockets : 1 } ) ;
4545 http . get ( {
4646 port : this . address ( ) . port ,
4747 path : '/hello' ,
4848 headers : { 'Accept' : '*/*' , 'Foo' : 'bar' } ,
4949 agent : agent
5050 } , function ( res ) {
51- assert . equal ( 200 , res . statusCode ) ;
51+ assert . strictEqual ( 200 , res . statusCode ) ;
5252 responses_recvd += 1 ;
5353 res . setEncoding ( 'utf8' ) ;
5454 res . on ( 'data' , function ( chunk ) { body0 += chunk ; } ) ;
5555 console . error ( 'Got /hello response' ) ;
5656 } ) ;
5757
5858 setTimeout ( function ( ) {
59- var req = http . request ( {
59+ const req = http . request ( {
6060 port : server . address ( ) . port ,
6161 method : 'POST' ,
6262 path : '/world' ,
6363 agent : agent
6464 } , function ( res ) {
65- assert . equal ( 200 , res . statusCode ) ;
65+ assert . strictEqual ( 200 , res . statusCode ) ;
6666 responses_recvd += 1 ;
6767 res . setEncoding ( 'utf8' ) ;
6868 res . on ( 'data' , function ( chunk ) { body1 += chunk ; } ) ;
@@ -74,12 +74,11 @@ server.on('listening', function() {
7474
7575process . on ( 'exit' , function ( ) {
7676 console . error ( 'responses_recvd: ' + responses_recvd ) ;
77- assert . equal ( 2 , responses_recvd ) ;
77+ assert . strictEqual ( 2 , responses_recvd ) ;
7878
7979 console . error ( 'responses_sent: ' + responses_sent ) ;
80- assert . equal ( 2 , responses_sent ) ;
80+ assert . strictEqual ( 2 , responses_sent ) ;
8181
82- assert . equal ( 'The path was /hello' , body0 ) ;
83- assert . equal ( 'The path was /world' , body1 ) ;
82+ assert . strictEqual ( 'The path was /hello' , body0 ) ;
83+ assert . strictEqual ( 'The path was /world' , body1 ) ;
8484} ) ;
85-
0 commit comments