(bodyType)
| 521 | pipeliningNonIdempotentWithBody(consts.ASYNC_ITERATOR) |
| 522 | |
| 523 | function pipeliningHeadBusy (bodyType) { |
| 524 | test(`pipelining HEAD busy ${bodyType}`, async (t) => { |
| 525 | t = tspl(t, { plan: 7 }) |
| 526 | |
| 527 | const server = createServer({ joinDuplicateHeaders: true }) |
| 528 | server.on('request', (req, res) => { |
| 529 | res.end('asd') |
| 530 | }) |
| 531 | after(() => server.close()) |
| 532 | |
| 533 | server.listen(0, () => { |
| 534 | const client = new Client(`http://localhost:${server.address().port}`, { |
| 535 | pipelining: 10 |
| 536 | }) |
| 537 | after(() => client.close()) |
| 538 | |
| 539 | client[kConnect](() => { |
| 540 | let ended = false |
| 541 | client.once('disconnect', () => { |
| 542 | t.strictEqual(ended, true) |
| 543 | }) |
| 544 | |
| 545 | { |
| 546 | const body = new Readable({ |
| 547 | read () { } |
| 548 | }) |
| 549 | client.request({ |
| 550 | path: '/', |
| 551 | method: 'GET', |
| 552 | body: maybeWrapStream(body, bodyType) |
| 553 | }, (err, data) => { |
| 554 | t.ifError(err) |
| 555 | data.body |
| 556 | .resume() |
| 557 | .on('end', () => { |
| 558 | t.ok(true, 'pass') |
| 559 | }) |
| 560 | }) |
| 561 | body.push(null) |
| 562 | t.strictEqual(client[kBusy], true) |
| 563 | } |
| 564 | |
| 565 | { |
| 566 | const body = new Readable({ |
| 567 | read () { } |
| 568 | }) |
| 569 | client.request({ |
| 570 | path: '/', |
| 571 | method: 'HEAD', |
| 572 | body: maybeWrapStream(body, bodyType) |
| 573 | }, (err, data) => { |
| 574 | t.ifError(err) |
| 575 | data.body |
| 576 | .resume() |
| 577 | .on('end', () => { |
| 578 | ended = true |
| 579 | t.ok(true, 'pass') |
| 580 | }) |
no test coverage detected
searching dependent graphs…