MCPcopy
hub / github.com/nodejs/undici / dispatch

Method dispatch

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 8

connectFunction · 0.45
pipelineFunction · 0.45
streamFunction · 0.45
upgradeFunction · 0.45
requestFunction · 0.45
onResponseEndMethod · 0.45
retryMethod · 0.45

Calls 3

getMethod · 0.95
normalizeOriginFunction · 0.85
normalizeSearchParamsFunction · 0.85

Tested by

no test coverage detected