MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-http-parser.js:420–444  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

418 );
419
420 function test(a, b) {
421 const onHeadersComplete = mustCall((versionMajor, versionMinor, headers,
422 method, url) => {
423 assert.strictEqual(method, methods.indexOf('POST'));
424 assert.strictEqual(url || parser.url, '/helpme');
425 assert.strictEqual(versionMajor, 1);
426 assert.strictEqual(versionMinor, 1);
427 });
428
429 let expected_body = '123123456123456789123456789ABC123456789ABCDEF';
430
431 const onBody = mustCallAtLeast((buf) => {
432 const chunk = String(buf);
433 assert.strictEqual(expected_body.indexOf(chunk), 0);
434 expected_body = expected_body.slice(chunk.length);
435 });
436
437 const parser = newParser(REQUEST);
438 parser[kOnHeadersComplete] = mustCall(onHeadersComplete);
439 parser[kOnBody] = onBody;
440 parser.execute(a, 0, a.length);
441 parser.execute(b, 0, b.length);
442
443 assert.strictEqual(expected_body, '');
444 }
445
446 for (let i = 1; i < request.length - 1; ++i) {
447 const a = request.slice(0, i);

Callers 1

Calls 7

mustCallAtLeastFunction · 0.85
StringClass · 0.85
mustCallFunction · 0.70
newParserFunction · 0.70
sliceMethod · 0.65
indexOfMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…