MCPcopy Index your code
hub / github.com/angular/angular / makeCacheKey

Function makeCacheKey

packages/common/http/src/transfer_cache.ts:384–402  ·  view source on GitHub ↗
(
  request: HttpRequest<any>,
  mappedRequestUrl: string,
)

Source from the content-addressed store, hash-verified

382}
383
384function makeCacheKey(
385 request: HttpRequest<any>,
386 mappedRequestUrl: string,
387): StateKey<TransferHttpResponse> {
388 const {params, method, responseType} = request;
389 const encodedParams = sortAndConcatParams(params);
390
391 let serializedBody = request.serializeBody();
392 if (serializedBody instanceof URLSearchParams) {
393 serializedBody = sortAndConcatParams(serializedBody);
394 } else if (typeof serializedBody !== 'string') {
395 serializedBody = '';
396 }
397
398 const key = [method, responseType, mappedRequestUrl, serializedBody, encodedParams].join('|');
399 const hash = generateHash(key);
400
401 return makeStateKey(hash);
402}
403
404function toBase64(buffer: unknown): string {
405 //TODO: replace with when is Baseline widely available

Callers 2

retrieveStateFromCacheFunction · 0.85

Calls 5

makeStateKeyFunction · 0.90
sortAndConcatParamsFunction · 0.85
generateHashFunction · 0.85
serializeBodyMethod · 0.80
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…