MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / buildMockDispatch

Function buildMockDispatch

out/cli.cjs:57351–57378  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57349 handler.onData(Buffer.from(responseData));
57350 handler.onComplete(responseTrailers);
57351 deleteMockDispatch(mockDispatches, key);
57352 }
57353 function resume2() {
57354 }
57355 return true;
57356 }
57357 function buildMockDispatch() {
57358 const agent = this[kMockAgent];
57359 const origin2 = this[kOrigin];
57360 const originalDispatch = this[kOriginalDispatch];
57361 return function dispatch(opts, handler) {
57362 if (agent.isMockActive) {
57363 try {
57364 mockDispatch.call(this, opts, handler);
57365 } catch (error) {
57366 if (error instanceof MockNotMatchedError) {
57367 const netConnect = agent[kGetNetConnect]();
57368 if (netConnect === false) {
57369 throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin2} was not allowed (net.connect disabled)`);
57370 }
57371 if (checkNetConnect(netConnect, origin2)) {
57372 originalDispatch.call(this, opts, handler);
57373 } else {
57374 throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin2} was not allowed (net.connect is not enabled for this origin)`);
57375 }
57376 } else {
57377 throw error;
57378 }
57379 }
57380 } else {
57381 originalDispatch.call(this, opts, handler);

Callers

nothing calls this directly

Calls 1

checkNetConnectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…