diff --git a/packages/medusa-js/src/request.ts b/packages/medusa-js/src/request.ts index 2f98064308..d9f928aef8 100644 --- a/packages/medusa-js/src/request.ts +++ b/packages/medusa-js/src/request.ts @@ -1,4 +1,9 @@ -import axios, { AxiosError, AxiosInstance, AxiosRequestHeaders } from "axios" +import axios, { + AxiosAdapter, + AxiosError, + AxiosInstance, + AxiosRequestHeaders, +} from "axios" import * as rax from "retry-axios" import { v4 as uuidv4 } from "uuid" @@ -18,11 +23,12 @@ export interface Config { apiKey?: string publishableApiKey?: string customHeaders?: Record + axiosAdapter?: AxiosAdapter } /** * @interface - * + * * Options to pass to requests sent to custom API Routes */ export interface RequestOptions { @@ -180,6 +186,7 @@ class Client { createClient(config: Config): AxiosInstance { const client = axios.create({ baseURL: config.baseUrl, + adapter: config.axiosAdapter, }) rax.attach(client) @@ -221,8 +228,8 @@ class Client { options: RequestOptions = {}, customHeaders: Record = {} ): Promise { - - customHeaders = { ...this.config.customHeaders, ...customHeaders } + + customHeaders = { ...this.config.customHeaders, ...customHeaders } const reqOpts = { method,