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 if (typeof mockDispatch2.headers === "undefined") {
10982 return true;
10983 }
10984 if (typeof headers !== "object" || typeof mockDispatch2.headers !== "object") {
10985 return false;
10986 }
10987 for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch2.headers)) {
10988 const headerValue = getHeaderByName(headers, matchHeaderName);
10989 if (!matchValue(matchHeaderValue, headerValue)) {
10990 return false;
10991 }
10992 }
10993 return true;
10994 }
10995 function safeUrl(path4) {
10996 if (typeof path4 !== "string") {
10997 return path4;
10998 }
10999 const pathSegments = path4.split("?");
11000 if (pathSegments.length !== 2) {
11001 return path4;
11002 }
11003 const qp = new URLSearchParams(pathSegments.pop());
11004 qp.sort();
11005 return [...pathSegments, qp.toString()].join("?");
11006 }
11007 function matchKey(mockDispatch2, { path: path4, method, body, headers }) {

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