* Mock an undici request with a defined reply.
(replyOptionsCallbackOrStatusCode)
| 11272 | var MockInterceptor = class { |
| 11273 | constructor(opts, mockDispatches) { |
| 11274 | if (typeof opts !== "object") { |
| 11275 | throw new InvalidArgumentError("opts must be an object"); |
| 11276 | } |
| 11277 | if (typeof opts.path === "undefined") { |
| 11278 | throw new InvalidArgumentError("opts.path must be defined"); |
| 11279 | } |
| 11280 | if (typeof opts.method === "undefined") { |
| 11281 | opts.method = "GET"; |
| 11282 | } |
| 11283 | if (typeof opts.path === "string") { |
| 11284 | if (opts.query) { |
| 11285 | opts.path = buildURL(opts.path, opts.query); |
| 11286 | } else { |
| 11287 | const parsedURL = new URL(opts.path, "data://"); |
| 11288 | opts.path = parsedURL.pathname + parsedURL.search; |
| 11289 | } |
| 11290 | } |
| 11291 | if (typeof opts.method === "string") { |
| 11292 | opts.method = opts.method.toUpperCase(); |
| 11293 | } |
| 11294 | this[kDispatchKey] = buildKey(opts); |
| 11295 | this[kDispatches] = mockDispatches; |
| 11296 | this[kDefaultHeaders] = {}; |
| 11297 | this[kDefaultTrailers] = {}; |
| 11298 | this[kContentLength] = false; |
| 11299 | } |
| 11300 | createMockScopeDispatchData({ statusCode, data, responseOptions }) { |