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

Function makeCacheKey

lib/util/cache.js:14–31  ·  view source on GitHub ↗

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

(opts)

Source from the content-addressed store, hash-verified

12 * @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
13 */
14function makeCacheKey (opts) {
15 if (!opts.origin) {
16 throw new Error('opts.origin is undefined')
17 }
18
19 let fullPath = opts.path || '/'
20
21 if (opts.query && !pathHasQueryOrFragment(fullPath)) {
22 fullPath = serializePathWithQuery(fullPath, opts.query)
23 }
24
25 return {
26 origin: opts.origin.toString(),
27 method: opts.method,
28 path: fullPath,
29 headers: opts.headers
30 }
31}
32
33/**
34 * @param {Record<string, string[] | string>}

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…