MCPcopy Create free account
hub / github.com/nodejs/undici / pipeliningHeadBusy

Function pipeliningHeadBusy

test/client-pipelining.js:523–590  ·  view source on GitHub ↗
(bodyType)

Source from the content-addressed store, hash-verified

521pipeliningNonIdempotentWithBody(consts.ASYNC_ITERATOR)
522
523function 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 })

Callers 1

Calls 10

createServerFunction · 0.85
maybeWrapStreamFunction · 0.85
listenMethod · 0.80
okMethod · 0.80
closeMethod · 0.65
resumeMethod · 0.65
onMethod · 0.45
endMethod · 0.45
requestMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…