@ -96,9 +96,9 @@ function expectBody(expected) {
'GET /hello HTTP/1.1' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 1 ) ;
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
@ -137,9 +137,9 @@ function expectBody(expected) {
CRLF +
'pong' ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , undefined ) ;
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 1 ) ;
@ -147,7 +147,7 @@ function expectBody(expected) {
assert . strictEqual ( statusMessage , 'OK' ) ;
} ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const body = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( body , 'pong' ) ;
} ;
@ -167,9 +167,9 @@ function expectBody(expected) {
'HTTP/1.0 200 Connection established' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 0 ) ;
assert . strictEqual ( method , undefined ) ;
@ -201,15 +201,15 @@ function expectBody(expected) {
let seen_body = false ;
const onHeaders = function ( headers , url ) {
const onHeaders = ( headers , url ) => {
assert . ok ( seen_body ) ; // trailers should come after the body
assert . deepStrictEqual ( headers ,
[ 'Vary' , '*' , 'Content-Type' , 'text/plain' ] ) ;
} ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -218,7 +218,7 @@ function expectBody(expected) {
parser [ kOnHeaders ] = mustCall ( onHeaders ) ;
} ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const body = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( body , 'ping' ) ;
seen_body = true ;
@ -242,9 +242,9 @@ function expectBody(expected) {
'X-Filler2: 42' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 0 ) ;
@ -272,9 +272,9 @@ function expectBody(expected) {
lots_of_headers +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
assert . strictEqual ( url || parser . url , '/foo/bar/baz?quux=42#1337' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -306,16 +306,16 @@ function expectBody(expected) {
CRLF +
'foo=42&bar=1337' ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 1 ) ;
} ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const body = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( body , 'foo=42&bar=1337' ) ;
} ;
@ -344,9 +344,9 @@ function expectBody(expected) {
'1234567890' + CRLF +
'0' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -356,7 +356,7 @@ function expectBody(expected) {
let body_part = 0 ;
const body_parts = [ '123' , '123456' , '1234567890' ] ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const body = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( body , body_parts [ body_part ++ ] ) ;
} ;
@ -382,9 +382,9 @@ function expectBody(expected) {
'6' + CRLF +
'123456' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -395,7 +395,7 @@ function expectBody(expected) {
const body_parts =
[ '123' , '123456' , '123456789' , '123456789ABC' , '123456789ABCDEF' ] ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const body = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( body , body_parts [ body_part ++ ] ) ;
} ;
@ -440,9 +440,9 @@ function expectBody(expected) {
'0' + CRLF ) ;
function test ( a , b ) {
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/helpme' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -451,7 +451,7 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF' ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const chunk = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( expected_body . indexOf ( chunk ) , 0 ) ;
expected_body = expected_body . slice ( chunk . length ) ;
@ -499,9 +499,9 @@ function expectBody(expected) {
'123456789ABCDEF' + CRLF +
'0' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -513,7 +513,7 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF' ;
const onBody = function ( buf , start , len ) {
const onBody = ( buf , start , len ) => {
const chunk = '' + buf . slice ( start , start + len ) ;
assert . strictEqual ( expected_body . indexOf ( chunk ) , 0 ) ;
expected_body = expected_body . slice ( chunk . length ) ;
@ -551,9 +551,9 @@ function expectBody(expected) {
CRLF +
'pong' ) ;
const onHeadersComplete1 = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete1 = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'PUT' ) ) ;
assert . strictEqual ( url , '/this' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -563,9 +563,9 @@ function expectBody(expected) {
[ 'Content-Type' , 'text/plain' , 'Transfer-Encoding' , 'chunked' ] ) ;
} ;
const onHeadersComplete2 = function ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
const onHeadersComplete2 = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url , '/that' ) ;
assert . strictEqual ( versionMajor , 1 ) ;