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