@ -77,9 +77,9 @@ function expectBody(expected) {
'GET /hello HTTP/1.1' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 1 ) ;
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
@ -118,9 +118,9 @@ function expectBody(expected) {
CRLF +
'pong' ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , undefined ) ;
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 1 ) ;
@ -128,7 +128,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' ) ;
} ;
@ -148,9 +148,9 @@ function expectBody(expected) {
'HTTP/1.0 200 Connection established' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 0 ) ;
assert . strictEqual ( method , undefined ) ;
@ -182,15 +182,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 ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -199,7 +199,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 ;
@ -223,9 +223,9 @@ function expectBody(expected) {
'X-Filler2: 42' + CRLF +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
assert . strictEqual ( versionMajor , 1 ) ;
assert . strictEqual ( versionMinor , 0 ) ;
@ -253,9 +253,9 @@ function expectBody(expected) {
lots_of_headers +
CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'GET' ) ) ;
assert . strictEqual ( url || parser . url , '/foo/bar/baz?quux=42#1337' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -287,16 +287,16 @@ function expectBody(expected) {
CRLF +
'foo=42&bar=1337' ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
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' ) ;
} ;
@ -325,9 +325,9 @@ function expectBody(expected) {
'1234567890' + CRLF +
'0' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -337,7 +337,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 ++ ] ) ;
} ;
@ -363,9 +363,9 @@ function expectBody(expected) {
'6' + CRLF +
'123456' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -376,7 +376,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 ++ ] ) ;
} ;
@ -421,9 +421,9 @@ function expectBody(expected) {
'0' + CRLF ) ;
function test ( a , b ) {
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/helpme' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -432,7 +432,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 ) ;
@ -480,9 +480,9 @@ function expectBody(expected) {
'123456789ABCDEF' + CRLF +
'0' + CRLF ) ;
const onHeadersComplete = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url || parser . url , '/it' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -494,7 +494,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 ) ;
@ -532,9 +532,9 @@ function expectBody(expected) {
CRLF +
'pong' ) ;
const onHeadersComplete1 = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete1 = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'PUT' ) ) ;
assert . strictEqual ( url , '/this' ) ;
assert . strictEqual ( versionMajor , 1 ) ;
@ -544,9 +544,9 @@ function expectBody(expected) {
[ 'Content-Type' , 'text/plain' , 'Transfer-Encoding' , 'chunked' ] ) ;
} ;
const onHeadersComplete2 = function ( versionMajor , versionMinor , headers ,
const onHeadersComplete2 = ( versionMajor , versionMinor , headers ,
method , url , statusCode , statusMessage ,
upgrade , shouldKeepAlive ) {
upgrade , shouldKeepAlive ) => {
assert . strictEqual ( method , methods . indexOf ( 'POST' ) ) ;
assert . strictEqual ( url , '/that' ) ;
assert . strictEqual ( versionMajor , 1 ) ;