@ -16,23 +16,23 @@ var server = http.createServer(function(req, res) {
req . id = request_number ++ ;
req . id = request_number ++ ;
if ( req . id === 0 ) {
if ( req . id === 0 ) {
assert . e qual( 'GET' , req . method ) ;
assert . strictE qual( 'GET' , req . method ) ;
assert . e qual( '/hello' , url . parse ( req . url ) . pathname ) ;
assert . strictE qual( '/hello' , url . parse ( req . url ) . pathname ) ;
assert . e qual( 'world' , qs . parse ( url . parse ( req . url ) . query ) . hello ) ;
assert . strictE qual( 'world' , qs . parse ( url . parse ( req . url ) . query ) . hello ) ;
assert . e qual( 'b==ar' , qs . parse ( url . parse ( req . url ) . query ) . foo ) ;
assert . strictE qual( 'b==ar' , qs . parse ( url . parse ( req . url ) . query ) . foo ) ;
}
}
if ( req . id === 1 ) {
if ( req . id === 1 ) {
assert . e qual( 'POST' , req . method ) ;
assert . strictE qual( 'POST' , req . method ) ;
assert . e qual( '/quit' , url . parse ( req . url ) . pathname ) ;
assert . strictE qual( '/quit' , url . parse ( req . url ) . pathname ) ;
}
}
if ( req . id === 2 ) {
if ( req . id === 2 ) {
assert . e qual( 'foo' , req . headers [ 'x-x' ] ) ;
assert . strictE qual( 'foo' , req . headers [ 'x-x' ] ) ;
}
}
if ( req . id === 3 ) {
if ( req . id === 3 ) {
assert . e qual( 'bar' , req . headers [ 'x-x' ] ) ;
assert . strictE qual( 'bar' , req . headers [ 'x-x' ] ) ;
this . close ( ) ;
this . close ( ) ;
}
}
@ -75,7 +75,7 @@ server.on('listening', function() {
// you set server.httpAllowHalfOpen=true, which we've done
// you set server.httpAllowHalfOpen=true, which we've done
// above.
// above.
c . end ( ) ;
c . end ( ) ;
assert . e qual( c . readyState , 'readOnly' ) ;
assert . strictE qual( c . readyState , 'readOnly' ) ;
requests_sent += 2 ;
requests_sent += 2 ;
}
}
@ -86,19 +86,19 @@ server.on('listening', function() {
} ) ;
} ) ;
c . on ( 'close' , function ( ) {
c . on ( 'close' , function ( ) {
assert . e qual( c . readyState , 'closed' ) ;
assert . strictE qual( c . readyState , 'closed' ) ;
} ) ;
} ) ;
} ) ;
} ) ;
process . on ( 'exit' , function ( ) {
process . on ( 'exit' , function ( ) {
assert . e qual( 4 , request_number ) ;
assert . strictE qual( 4 , request_number ) ;
assert . e qual( 4 , requests_sent ) ;
assert . strictE qual( 4 , requests_sent ) ;
var hello = new RegExp ( '/hello' ) ;
var hello = new RegExp ( '/hello' ) ;
assert . equal ( true , hello . exec ( server_response ) != null ) ;
assert . notStrictEqual ( null , hello . exec ( server_response ) ) ;
var quit = new RegExp ( '/quit' ) ;
var quit = new RegExp ( '/quit' ) ;
assert . equal ( true , quit . exec ( server_response ) != null ) ;
assert . notStrictEqual ( null , quit . exec ( server_response ) ) ;
assert . e qual( true , client_got_eof ) ;
assert . strictE qual( true , client_got_eof ) ;
} ) ;
} ) ;