Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jul 2, 2024
1 parent cbee62e commit 451661d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/mock_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = {
if (!_global) {
_global = getGlobalDispatcher();
}
if (!app[APP_HTTPCLIENT_AGENT] && typeof app?.httpclient?.getDispatcher === 'function') {
if (!app?.httpclient?.[APP_HTTPCLIENT_AGENT] && typeof app?.httpclient?.getDispatcher === 'function') {
// save the raw dispatcher
app[APP_HTTPCLIENT_AGENT] = app.httpclient.getDispatcher();
app.httpclient[APP_HTTPCLIENT_AGENT] = app.httpclient.getDispatcher();
}
if (!_mockAgent) {
_mockAgent = new MockAgent();
Expand All @@ -27,8 +27,8 @@ module.exports = {
if (_global) {
setGlobalDispatcher(_global);
}
if (app?.[APP_HTTPCLIENT_AGENT]) {
app.httpclient.setDispatcher(app[APP_HTTPCLIENT_AGENT]);
if (app?.httpclient?.[APP_HTTPCLIENT_AGENT]) {
app.httpclient.setDispatcher(app.httpclient[APP_HTTPCLIENT_AGENT]);
}
_mockAgent = null;
},
Expand Down

0 comments on commit 451661d

Please sign in to comment.