MCPcopy
hub / github.com/nodejs/undici / readBody

Function readBody

test/response-queue-poisoning.js:9–17  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

7const { Client } = require('..')
8
9function readBody (body) {
10 return new Promise((resolve, reject) => {
11 let data = ''
12 body.setEncoding('latin1')
13 body.on('data', chunk => { data += chunk })
14 body.on('end', () => resolve(data))
15 body.on('error', reject)
16 })
17}
18
19test('should not reuse an idle socket with buffered unsolicited response bytes', async () => {
20 let evilServerSocket

Callers 1

Calls 3

resolveFunction · 0.85
setEncodingMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…