MCPcopy Create free account
hub / github.com/angular/dev-infra / getMockDispatch

Function getMockDispatch

github-actions/browserstack/set-browserstack-env.js:10983–11004  ·  view source on GitHub ↗
(mockDispatches, key)

Source from the content-addressed store, hash-verified

10981 } else if (typeof headers.get === "function") {
10982 return headers.get(key);
10983 } else {
10984 return lowerCaseEntries(headers)[key.toLocaleLowerCase()];
10985 }
10986 }
10987 function buildHeadersFromArray(headers) {
10988 const clone = headers.slice();
10989 const entries = [];
10990 for (let index = 0; index < clone.length; index += 2) {
10991 entries.push([clone[index], clone[index + 1]]);
10992 }
10993 return Object.fromEntries(entries);
10994 }
10995 function matchHeaders(mockDispatch2, headers) {
10996 if (typeof mockDispatch2.headers === "function") {
10997 if (Array.isArray(headers)) {
10998 headers = buildHeadersFromArray(headers);
10999 }
11000 return mockDispatch2.headers(headers ? lowerCaseEntries(headers) : {});
11001 }
11002 if (typeof mockDispatch2.headers === "undefined") {
11003 return true;
11004 }
11005 if (typeof headers !== "object" || typeof mockDispatch2.headers !== "object") {
11006 return false;
11007 }

Callers 1

mockDispatchFunction · 0.70

Calls 5

buildURLFunction · 0.70
safeUrlFunction · 0.70
matchValueFunction · 0.70
matchHeadersFunction · 0.70
stringifyMethod · 0.45

Tested by

no test coverage detected