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

Function request

deps/undici/undici.js:17629–17647  ·  view source on GitHub ↗
(opts, callback)

Source from the content-addressed store, hash-verified

17627 }
17628 };
17629 function request(opts, callback) {
17630 if (callback === void 0) {
17631 return new Promise((resolve, reject) => {
17632 request.call(this, opts, (err, data) => {
17633 return err ? reject(err) : resolve(data);
17634 });
17635 });
17636 }
17637 try {
17638 const handler = new RequestHandler(opts, callback);
17639 this.dispatch(opts, handler);
17640 } catch (err) {
17641 if (typeof callback !== "function") {
17642 throw err;
17643 }
17644 const opaque = opts?.opaque;
17645 queueMicrotask(() => callback(err, { opaque }));
17646 }
17647 }
17648 __name(request, "request");
17649 module2.exports = request;
17650 module2.exports.RequestHandler = RequestHandler;

Callers

nothing calls this directly

Calls 6

queueMicrotaskFunction · 0.85
dispatchMethod · 0.65
rejectFunction · 0.50
resolveFunction · 0.50
callbackFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected