MCPcopy Create free account
hub / github.com/nodejs/undici / makeCacheKey

Function makeCacheKey

lib/util/cache.js:150–165  ·  view source on GitHub ↗

* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts

(opts)

Source from the content-addressed store, hash-verified

148 * @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
149 */
150function makeCacheKey (opts) {
151 const origin = opts.origin ? opts.origin.toString() : ''
152
153 let fullPath = opts.path || '/'
154
155 if (opts.query && !pathHasQueryOrFragment(fullPath)) {
156 fullPath = serializePathWithQuery(fullPath, opts.query)
157 }
158
159 return {
160 origin,
161 method: opts.method,
162 path: fullPath,
163 headers: opts.headers
164 }
165}
166
167function appendHeader (headers, key, val) {
168 const headerName = key.toLowerCase()

Callers 4

cache.jsFile · 0.85
deduplicate.jsFile · 0.85
issue-4209.jsFile · 0.85
cache.jsFile · 0.85

Calls 3

pathHasQueryOrFragmentFunction · 0.85
serializePathWithQueryFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected