MCPcopy Create free account
hub / github.com/nodejs/node / urlIsLocal

Function urlIsLocal

deps/undici/src/lib/web/fetch/util.js:1026–1034  ·  view source on GitHub ↗

* @see https://fetch.spec.whatwg.org/#is-local * @param {URL} url * @returns {boolean}

(url)

Source from the content-addressed store, hash-verified

1024 * @returns {boolean}
1025 */
1026function urlIsLocal (url) {
1027 assert('protocol' in url) // ensure it's a url object
1028
1029 const protocol = url.protocol
1030
1031 // A URL is local if its scheme is a local scheme.
1032 // A local scheme is "about", "blob", or "data".
1033 return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:'
1034}
1035
1036/**
1037 * @param {string|URL} url

Callers 2

stripURLForReferrerFunction · 0.70
mainFetchFunction · 0.70

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected