MCPcopy Create free account
hub / github.com/angular/angular / hasUncacheableCacheControl

Function hasUncacheableCacheControl

packages/common/http/src/transfer_cache.ts:357–370  ·  view source on GitHub ↗
(headers: HttpHeaders)

Source from the content-addressed store, hash-verified

355const UNCACHEABLE_CACHE_CONTROL_DIRECTIVES = new Set(['no-store', 'private', 'no-cache']);
356
357function hasUncacheableCacheControl(headers: HttpHeaders): boolean {
358 const cacheControlValues = headers.getAll('cache-control');
359
360 if (!cacheControlValues) {
361 return false;
362 }
363
364 return cacheControlValues.some((cacheControl) =>
365 cacheControl.split(',').some((directive) => {
366 const directiveName = directive.split('=', 1)[0].trim().toLowerCase();
367 return UNCACHEABLE_CACHE_CONTROL_DIRECTIVES.has(directiveName);
368 }),
369 );
370}
371
372function hasSetCookieHeader(headers: HttpHeaders): boolean {
373 return headers.has('set-cookie');

Callers 2

canUseOrCacheRequestFunction · 0.85

Calls 3

someMethod · 0.80
getAllMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected