mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
fix(index): add create to index exports (#6460)
Co-authored-by: Felippe Leitao Nacif <felippe.nacif@olxbr.com>
This commit is contained in:
Vendored
+2
@@ -724,6 +724,8 @@ export function mergeConfig<D = any>(
|
||||
config2: AxiosRequestConfig<D>
|
||||
): AxiosRequestConfig<D>;
|
||||
|
||||
export function create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||
|
||||
export interface AxiosStatic extends AxiosInstance {
|
||||
Cancel: CancelStatic;
|
||||
CancelToken: CancelTokenStatic;
|
||||
|
||||
@@ -20,10 +20,12 @@ const {
|
||||
formToJSON,
|
||||
getAdapter,
|
||||
mergeConfig,
|
||||
create,
|
||||
} = axios;
|
||||
|
||||
export {
|
||||
axios as default,
|
||||
create,
|
||||
Axios,
|
||||
AxiosError,
|
||||
CanceledError,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it } from 'vitest';
|
||||
import assert from 'assert';
|
||||
import axios from '../../index.js';
|
||||
import axios, { create } from '../../index.js';
|
||||
|
||||
describe('static api', () => {
|
||||
it('should have request method helpers', () => {
|
||||
@@ -53,6 +53,11 @@ describe('static api', () => {
|
||||
assert.strictEqual(typeof axios.create, 'function');
|
||||
});
|
||||
|
||||
it('should expose create as a named export', () => {
|
||||
assert.strictEqual(typeof create, 'function');
|
||||
assert.strictEqual(create, axios.create);
|
||||
});
|
||||
|
||||
it('should have CanceledError, CancelToken, and isCancel properties', () => {
|
||||
assert.strictEqual(typeof axios.Cancel, 'function');
|
||||
assert.strictEqual(typeof axios.CancelToken, 'function');
|
||||
|
||||
Reference in New Issue
Block a user