@vtex/api
Version:
VTEX I/O API client
23 lines (22 loc) • 991 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfiguredAxios = void 0;
const axios_1 = __importDefault(require("axios"));
const HttpAgentSingleton_1 = require("../HttpAgentSingleton");
const interceptors_1 = require("./interceptors");
const getConfiguredAxios = () => {
const httpAgent = HttpAgentSingleton_1.HttpAgentSingleton.getHttpAgent();
const http = axios_1.default.create({
httpAgent,
});
(0, interceptors_1.addTracingPreRequestInterceptor)(http);
// Do not change this order, otherwise each request span will
// wait all retries to finish before finishing the span
(0, interceptors_1.addTracingResponseInterceptor)(http);
(0, interceptors_1.addExponentialBackoffResponseInterceptor)(http);
return http;
};
exports.getConfiguredAxios = getConfiguredAxios;