MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / getUrlForFetchCacheKey

Function getUrlForFetchCacheKey

src/cache.ts:392–407  ·  view source on GitHub ↗
(url: RequestInfo)

Source from the content-addressed store, hash-verified

390}
391
392function getUrlForFetchCacheKey(url: RequestInfo) {
393 const urlString = url instanceof Request ? url.url : String(url);
394 try {
395 const parsedUrl = new URL(urlString);
396 if (!hasSensitiveSearchParam(parsedUrl.searchParams)) {
397 return urlString;
398 }
399 parsedUrl.search = '';
400 return {
401 href: parsedUrl.toString(),
402 searchParams: getSearchParamsForFetchCacheKey(new URL(urlString).searchParams),
403 };
404 } catch {
405 return getStringForFetchCacheKey(urlString);
406 }
407}
408
409function getHeadersForCacheKey(url: RequestInfo, options: RequestInit) {
410 const headers = new Headers(getFetchWithProxyHeaders(url, options));

Callers 1

getFetchCacheKeyFunction · 0.85

Calls 4

hasSensitiveSearchParamFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…