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

Function assertCacheKey

lib/util/cache.js:260–274  ·  view source on GitHub ↗

* @param {any} key

(key)

Source from the content-addressed store, hash-verified

258 * @param {any} key
259 */
260function assertCacheKey (key) {
261 if (typeof key !== 'object') {
262 throw new TypeError(`expected key to be object, got ${typeof key}`)
263 }
264
265 for (const property of ['origin', 'method', 'path']) {
266 if (typeof key[property] !== 'string') {
267 throw new TypeError(`expected key.${property} to be string, got ${typeof key[property]}`)
268 }
269 }
270
271 if (key.headers !== undefined && typeof key.headers !== 'object') {
272 throw new TypeError(`expected headers to be object, got ${typeof key}`)
273 }
274}
275
276/**
277 * @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