@@ -62,8 +62,8 @@ function newParser(type) {
62
62
63
63
64
64
function expectBody ( expected ) {
65
- return mustCall ( function ( buf , start , len ) {
66
- const body = String ( buf . slice ( start , start + len ) ) ;
65
+ return mustCall ( function ( buf ) {
66
+ const body = String ( buf ) ;
67
67
assert . strictEqual ( body , expected ) ;
68
68
} ) ;
69
69
}
@@ -126,8 +126,8 @@ function expectBody(expected) {
126
126
assert . strictEqual ( statusMessage , 'OK' ) ;
127
127
} ;
128
128
129
- const onBody = ( buf , start , len ) => {
130
- const body = String ( buf . slice ( start , start + len ) ) ;
129
+ const onBody = ( buf ) => {
130
+ const body = String ( buf ) ;
131
131
assert . strictEqual ( body , 'pong' ) ;
132
132
} ;
133
133
@@ -195,8 +195,8 @@ function expectBody(expected) {
195
195
parser [ kOnHeaders ] = mustCall ( onHeaders ) ;
196
196
} ;
197
197
198
- const onBody = ( buf , start , len ) => {
199
- const body = String ( buf . slice ( start , start + len ) ) ;
198
+ const onBody = ( buf ) => {
199
+ const body = String ( buf ) ;
200
200
assert . strictEqual ( body , 'ping' ) ;
201
201
seen_body = true ;
202
202
} ;
@@ -291,8 +291,8 @@ function expectBody(expected) {
291
291
assert . strictEqual ( versionMinor , 1 ) ;
292
292
} ;
293
293
294
- const onBody = ( buf , start , len ) => {
295
- const body = String ( buf . slice ( start , start + len ) ) ;
294
+ const onBody = ( buf ) => {
295
+ const body = String ( buf ) ;
296
296
assert . strictEqual ( body , 'foo=42&bar=1337' ) ;
297
297
} ;
298
298
@@ -332,8 +332,8 @@ function expectBody(expected) {
332
332
let body_part = 0 ;
333
333
const body_parts = [ '123' , '123456' , '1234567890' ] ;
334
334
335
- const onBody = ( buf , start , len ) => {
336
- const body = String ( buf . slice ( start , start + len ) ) ;
335
+ const onBody = ( buf ) => {
336
+ const body = String ( buf ) ;
337
337
assert . strictEqual ( body , body_parts [ body_part ++ ] ) ;
338
338
} ;
339
339
@@ -371,8 +371,8 @@ function expectBody(expected) {
371
371
const body_parts =
372
372
[ '123' , '123456' , '123456789' , '123456789ABC' , '123456789ABCDEF' ] ;
373
373
374
- const onBody = ( buf , start , len ) => {
375
- const body = String ( buf . slice ( start , start + len ) ) ;
374
+ const onBody = ( buf ) => {
375
+ const body = String ( buf ) ;
376
376
assert . strictEqual ( body , body_parts [ body_part ++ ] ) ;
377
377
} ;
378
378
@@ -428,8 +428,8 @@ function expectBody(expected) {
428
428
429
429
let expected_body = '123123456123456789123456789ABC123456789ABCDEF' ;
430
430
431
- const onBody = ( buf , start , len ) => {
432
- const chunk = String ( buf . slice ( start , start + len ) ) ;
431
+ const onBody = ( buf ) => {
432
+ const chunk = String ( buf ) ;
433
433
assert . strictEqual ( expected_body . indexOf ( chunk ) , 0 ) ;
434
434
expected_body = expected_body . slice ( chunk . length ) ;
435
435
} ;
@@ -445,9 +445,7 @@ function expectBody(expected) {
445
445
446
446
for ( let i = 1 ; i < request . length - 1 ; ++ i ) {
447
447
const a = request . slice ( 0 , i ) ;
448
- console . error ( `request.slice(0, ${ i } ) = ${ JSON . stringify ( a . toString ( ) ) } ` ) ;
449
448
const b = request . slice ( i ) ;
450
- console . error ( `request.slice(${ i } ) = ${ JSON . stringify ( b . toString ( ) ) } ` ) ;
451
449
test ( a , b ) ;
452
450
}
453
451
}
@@ -488,8 +486,8 @@ function expectBody(expected) {
488
486
489
487
let expected_body = '123123456123456789123456789ABC123456789ABCDEF' ;
490
488
491
- const onBody = ( buf , start , len ) => {
492
- const chunk = String ( buf . slice ( start , start + len ) ) ;
489
+ const onBody = ( buf ) => {
490
+ const chunk = String ( buf ) ;
493
491
assert . strictEqual ( expected_body . indexOf ( chunk ) , 0 ) ;
494
492
expected_body = expected_body . slice ( chunk . length ) ;
495
493
} ;
0 commit comments