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

Function getSameOriginPath

lib/handler/cache-handler.js:61–82  ·  view source on GitHub ↗
(cacheKey, location)

Source from the content-addressed store, hash-verified

59}
60
61function getSameOriginPath (cacheKey, location) {
62 if (typeof location !== 'string') {
63 return undefined
64 }
65
66 let originUrl
67 let requestUrl
68 let locationUrl
69 try {
70 originUrl = new URL(cacheKey.origin)
71 requestUrl = new URL(cacheKey.path, originUrl)
72 locationUrl = new URL(location, requestUrl)
73 } catch {
74 return undefined
75 }
76
77 if (locationUrl.origin !== originUrl.origin) {
78 return undefined
79 }
80
81 return locationUrl.pathname + locationUrl.search
82}
83
84function deleteCachedUri (store, cacheKey, path) {
85 deleteCachedValue(store, {

Callers 1

deleteLocationTargetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected