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

Function assertCacheKey

lib/util/cache.js:300–314  ·  view source on GitHub ↗

* @param {any} key

(key)

Source from the content-addressed store, hash-verified

298 * @param {any} key
299 */
300function assertCacheKey (key) {
301 if (typeof key !== 'object') {
302 throw new TypeError(`expected key to be object, got ${typeof key}`)
303 }
304
305 for (const property of ['origin', 'method', 'path']) {
306 if (typeof key[property] !== 'string') {
307 throw new TypeError(`expected key.${property} to be string, got ${typeof key[property]}`)
308 }
309 }
310
311 if (key.headers !== undefined && typeof key.headers !== 'object') {
312 throw new TypeError(`expected headers to be object, got ${typeof key}`)
313 }
314}
315
316/**
317 * @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