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

Method dispatch

deps/undici/src/lib/mock/mock-agent.js:72–91  ·  view source on GitHub ↗
(opts, handler)

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 5

getMethod · 0.95
normalizeOriginFunction · 0.85
normalizeSearchParamsFunction · 0.85
dispatchMethod · 0.65
splitMethod · 0.45

Tested by

no test coverage detected