(mockDispatches, _data = data)
| 57329 | } |
| 57330 | if (typeof delay3 === "number" && delay3 > 0) { |
| 57331 | setTimeout(() => { |
| 57332 | handleReply(this[kDispatches]); |
| 57333 | }, delay3); |
| 57334 | } else { |
| 57335 | handleReply(this[kDispatches]); |
| 57336 | } |
| 57337 | function handleReply(mockDispatches, _data = data) { |
| 57338 | const optsHeaders = Array.isArray(opts.headers) ? buildHeadersFromArray(opts.headers) : opts.headers; |
| 57339 | const body = typeof _data === "function" ? _data({ ...opts, headers: optsHeaders }) : _data; |
| 57340 | if (isPromise(body)) { |
| 57341 | body.then((newData) => handleReply(mockDispatches, newData)); |
| 57342 | return; |
| 57343 | } |
| 57344 | const responseData = getResponseData(body); |
| 57345 | const responseHeaders = generateKeyValues(headers); |
| 57346 | const responseTrailers = generateKeyValues(trailers); |
| 57347 | handler.abort = nop; |
| 57348 | handler.onHeaders(statusCode, responseHeaders, resume2, getStatusText(statusCode)); |
| 57349 | handler.onData(Buffer.from(responseData)); |
no test coverage detected
searching dependent graphs…