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

Function assertCacheKey

lib/util/cache.js:70–84  ·  view source on GitHub ↗

* @param {any} key

(key)

Source from the content-addressed store, hash-verified

68 * @param {any} key
69 */
70function assertCacheKey (key) {
71 if (typeof key !== 'object') {
72 throw new TypeError(`expected key to be object, got ${typeof key}`)
73 }
74
75 for (const property of ['origin', 'method', 'path']) {
76 if (typeof key[property] !== 'string') {
77 throw new TypeError(`expected key.${property} to be string, got ${typeof key[property]}`)
78 }
79 }
80
81 if (key.headers !== undefined && typeof key.headers !== 'object') {
82 throw new TypeError(`expected headers to be object, got ${typeof key}`)
83 }
84}
85
86/**
87 * @param {any} value

Callers 5

getMethod · 0.85
createWriteStreamMethod · 0.85
getMethod · 0.85
setMethod · 0.85
createWriteStreamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…