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

Function request

test/parser-issues.js:221–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219 })
220
221 function request () {
222 return new Promise((resolve, reject) => {
223 client.request({
224 method: 'GET',
225 path: '/'
226 }, (err, { statusCode, body } = {}) => {
227 if (err) {
228 reject(err)
229 return
230 }
231
232 const bufs = []
233
234 body.on('data', buf => {
235 bufs.push(buf)
236 })
237 body.on('end', () => {
238 resolve({
239 statusCode,
240 body: Buffer.concat(bufs)
241 })
242 })
243 body.on('error', reject)
244 })
245 })
246 }
247
248 const smallResponse = await request()
249 t.strictEqual(smallResponse.statusCode, 200)

Callers 1

parser-issues.jsFile · 0.70

Calls 5

rejectFunction · 0.85
resolveFunction · 0.85
requestMethod · 0.45
onMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…