diff --git a/src/api/BaseApi.ts b/src/api/BaseApi.ts index 80365cbd3..f8a65c185 100644 --- a/src/api/BaseApi.ts +++ b/src/api/BaseApi.ts @@ -197,8 +197,11 @@ export function generateAmApi({ ...headers, ...state.getAuthenticationHeaderOverrides(), }, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }, requestOverride @@ -269,8 +272,11 @@ export function generateOauth2Api({ ...headers, ...state.getAuthenticationHeaderOverrides(), }, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }; @@ -313,8 +319,11 @@ export function generateIdmApi({ Authorization: `Bearer ${state.getBearerToken()}`, }), }, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }, requestOverride @@ -358,8 +367,11 @@ export function generateLogKeysApi({ { timeout, headers, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }, requestOverride @@ -401,8 +413,11 @@ export function generateLogApi({ // baseURL: getTenantURL(storage.session.getTenant()), timeout, headers, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }, requestOverride @@ -452,8 +467,11 @@ export function generateEnvApi({ timeout, headers, ...requestOverride, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }; @@ -500,8 +518,11 @@ export function generateGovernanceApi({ timeout, headers, ...requestOverride, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(state.getAllowInsecureConnection()), + }), proxy: getProxy(), }; @@ -541,8 +562,11 @@ export function generateReleaseApi({ 'Content-Type': 'application/json', }, ...requestOverride, - httpAgent: getHttpAgent(), - httpsAgent: getHttpsAgent(false, false), + ...(process.env.FRODO_MOCK !== 'record' && + process.env.FRODO_POLLY_MODE !== 'record' && { + httpAgent: getHttpAgent(), + httpsAgent: getHttpsAgent(false, false), + }), proxy: getProxy(), };