MCPcopy
hub / github.com/angular/angular / match

Method match

packages/service-worker/worker/testing/cache.ts:141–155  ·  view source on GitHub ↗
(request: RequestInfo, options?: CacheQueryOptions)

Source from the content-addressed store, hash-verified

139 }
140
141 async match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response> {
142 let url = this.getRequestUrl(request);
143 let res = this.cache.get(url);
144 if (!res && options?.ignoreSearch) {
145 // check if cache has url by ignoring search
146 url = this.stripQueryAndHash(url);
147 const matchingReq = [...this.cache.keys()].find((key) => url === this.stripQueryAndHash(key));
148 if (matchingReq !== undefined) res = this.cache.get(matchingReq);
149 }
150
151 if (res !== undefined) {
152 res = res.clone();
153 }
154 return res!;
155 }
156
157 async matchAll(request?: Request | string, options?: CacheQueryOptions): Promise<Response[]> {
158 if (request === undefined) {

Callers 3

matchAllMethod · 0.95
getLatestHashFromDbFunction · 0.45
matchMethod · 0.45

Calls 6

getRequestUrlMethod · 0.95
stripQueryAndHashMethod · 0.95
getMethod · 0.65
keysMethod · 0.65
cloneMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected