···11+---
22+"@hey-api/openapi-ts": patch
33+---
44+55+fix(client-axios): allow passing `AxiosInstance` into `axios` field
+20-3
docs/openapi-ts/clients/axios.md
···210210You can implement your own `axios` instance. This is useful if you need to extend the default `axios` instance with extra functionality, or replace it altogether.
211211212212```js
213213+import axios from 'axios';
213214import { client } from 'client/client.gen';
214215216216+// Customize the default axios instance
217217+axios.defaults.baseURL = 'https://example.com';
218218+215219client.setConfig({
216216- axios: () => {
217217- /* custom `axios` instance */
218218- },
220220+ axios: axios,
221221+});
222222+```
223223+224224+or you can pass an `AxiosInstance` created with `axios.create()`:
225225+226226+```js
227227+import axios from 'axios';
228228+import { client } from 'client/client.gen';
229229+230230+const customAxiosInstance = axios.create({
231231+ baseURL: 'https://example.com',
232232+});
233233+234234+client.setConfig({
235235+ axios: customAxiosInstance,
219236});
220237```
221238
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */
···1717 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
1818 CoreConfig {
1919 /**
2020- * Axios implementation. You can use this option to provide a custom
2121- * Axios instance.
2020+ * Axios implementation. You can use this option to provide either an
2121+ * `AxiosStatic` or an `AxiosInstance`.
2222 *
2323 * @default axios
2424 */
2525- axios?: AxiosStatic;
2525+ axios?: AxiosStatic | AxiosInstance;
2626 /**
2727 * Base URL for all requests made by this client.
2828 */