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

Function getResponse

github-actions/browserstack/set-browserstack-env.js:11053–11073  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

11051 let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath));
11052 if (matchedMockDispatches.length === 0) {
11053 throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
11054 }
11055 matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method));
11056 if (matchedMockDispatches.length === 0) {
11057 throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`);
11058 }
11059 matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== "undefined" ? matchValue(body, key.body) : true);
11060 if (matchedMockDispatches.length === 0) {
11061 throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}' on path '${resolvedPath}'`);
11062 }
11063 matchedMockDispatches = matchedMockDispatches.filter((mockDispatch2) => matchHeaders(mockDispatch2, key.headers));
11064 if (matchedMockDispatches.length === 0) {
11065 const headers = typeof key.headers === "object" ? JSON.stringify(key.headers) : key.headers;
11066 throw new MockNotMatchedError(`Mock dispatch not matched for headers '${headers}' on path '${resolvedPath}'`);
11067 }
11068 return matchedMockDispatches[0];
11069 }
11070 function addMockDispatch(mockDispatches, key, data) {
11071 const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false };
11072 const replyData = typeof data === "function" ? { callback: data } : __spreadValues({}, data);
11073 const newMockDispatch = __spreadProps(__spreadValues(__spreadValues({}, baseData), key), { pending: true, data: __spreadValues({ error: null }, replyData) });
11074 mockDispatches.push(newMockDispatch);
11075 return newMockDispatch;
11076 }

Callers

nothing calls this directly

Calls 5

__asyncFunction · 0.70
__forAwaitFunction · 0.70
nextMethod · 0.45
pushMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected