mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +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>
|
config2: AxiosRequestConfig<D>
|
||||||
): AxiosRequestConfig<D>;
|
): AxiosRequestConfig<D>;
|
||||||
|
|
||||||
|
export function create(config?: CreateAxiosDefaults): AxiosInstance;
|
||||||
|
|
||||||
export interface AxiosStatic extends AxiosInstance {
|
export interface AxiosStatic extends AxiosInstance {
|
||||||
Cancel: CancelStatic;
|
Cancel: CancelStatic;
|
||||||
CancelToken: CancelTokenStatic;
|
CancelToken: CancelTokenStatic;
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ const {
|
|||||||
formToJSON,
|
formToJSON,
|
||||||
getAdapter,
|
getAdapter,
|
||||||
mergeConfig,
|
mergeConfig,
|
||||||
|
create,
|
||||||
} = axios;
|
} = axios;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
axios as default,
|
axios as default,
|
||||||
|
create,
|
||||||
Axios,
|
Axios,
|
||||||
AxiosError,
|
AxiosError,
|
||||||
CanceledError,
|
CanceledError,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, it } from 'vitest';
|
import { describe, it } from 'vitest';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import axios from '../../index.js';
|
import axios, { create } from '../../index.js';
|
||||||
|
|
||||||
describe('static api', () => {
|
describe('static api', () => {
|
||||||
it('should have request method helpers', () => {
|
it('should have request method helpers', () => {
|
||||||
@@ -53,6 +53,11 @@ describe('static api', () => {
|
|||||||
assert.strictEqual(typeof axios.create, 'function');
|
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', () => {
|
it('should have CanceledError, CancelToken, and isCancel properties', () => {
|
||||||
assert.strictEqual(typeof axios.Cancel, 'function');
|
assert.strictEqual(typeof axios.Cancel, 'function');
|
||||||
assert.strictEqual(typeof axios.CancelToken, 'function');
|
assert.strictEqual(typeof axios.CancelToken, 'function');
|
||||||
|
|||||||
Reference in New Issue
Block a user