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

Function request

lib/api/api-request.js:221–241  ·  view source on GitHub ↗
(opts, callback)

Source from the content-addressed store, hash-verified

219}
220
221function request (opts, callback) {
222 if (callback === undefined) {
223 return new Promise((resolve, reject) => {
224 request.call(this, opts, (err, data) => {
225 return err ? reject(err) : resolve(data)
226 })
227 })
228 }
229
230 try {
231 const handler = new RequestHandler(opts, callback)
232
233 this.dispatch(opts, handler)
234 } catch (err) {
235 if (typeof callback !== 'function') {
236 throw err
237 }
238 const opaque = opts?.opaque
239 queueMicrotask(() => callback(err, { opaque }))
240 }
241}
242
243module.exports = request
244module.exports.RequestHandler = RequestHandler

Callers

nothing calls this directly

Calls 3

rejectFunction · 0.85
resolveFunction · 0.85
dispatchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…