(opts, handler)
| 70 | } |
| 71 | |
| 72 | dispatch (opts, handler) { |
| 73 | opts.origin = normalizeOrigin(opts.origin) |
| 74 | |
| 75 | // Call MockAgent.get to perform additional setup before dispatching as normal |
| 76 | this.get(opts.origin) |
| 77 | |
| 78 | this[kMockAgentAddCallHistoryLog](opts) |
| 79 | |
| 80 | const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters] |
| 81 | |
| 82 | const dispatchOpts = { ...opts } |
| 83 | |
| 84 | if (acceptNonStandardSearchParameters && dispatchOpts.path) { |
| 85 | const [path, searchParams] = dispatchOpts.path.split('?') |
| 86 | const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters) |
| 87 | dispatchOpts.path = `${path}?${normalizedSearchParams}` |
| 88 | } |
| 89 | |
| 90 | return this[kAgent].dispatch(dispatchOpts, handler) |
| 91 | } |
| 92 | |
| 93 | async close () { |
| 94 | this.clearCallHistory() |
no test coverage detected