| 'use strict'; |
|
|
| import utils from './utils.js'; |
| import bind from './helpers/bind.js'; |
| import Axios from './core/Axios.js'; |
| import mergeConfig from './core/mergeConfig.js'; |
| import defaults from './defaults/index.js'; |
| import formDataToJSON from './helpers/formDataToJSON.js'; |
| import CanceledError from './cancel/CanceledError.js'; |
| import CancelToken from './cancel/CancelToken.js'; |
| import isCancel from './cancel/isCancel.js'; |
| import {VERSION} from './env/data.js'; |
| import toFormData from './helpers/toFormData.js'; |
| import AxiosError from './core/AxiosError.js'; |
| import spread from './helpers/spread.js'; |
| import isAxiosError from './helpers/isAxiosError.js'; |
| import AxiosHeaders from "./core/AxiosHeaders.js"; |
| import adapters from './adapters/adapters.js'; |
| import HttpStatusCode from './helpers/HttpStatusCode.js'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| function createInstance(defaultConfig) { |
| const context = new Axios(defaultConfig); |
| const instance = bind(Axios.prototype.request, context); |
|
|
| |
| utils.extend(instance, Axios.prototype, context, {allOwnKeys: true}); |
|
|
| |
| utils.extend(instance, context, null, {allOwnKeys: true}); |
|
|
| |
| instance.create = function create(instanceConfig) { |
| return createInstance(mergeConfig(defaultConfig, instanceConfig)); |
| }; |
|
|
| return instance; |
| } |
|
|
| |
| const axios = createInstance(defaults); |
|
|
| |
| axios.Axios = Axios; |
|
|
| |
| axios.CanceledError = CanceledError; |
| axios.CancelToken = CancelToken; |
| axios.isCancel = isCancel; |
| axios.VERSION = VERSION; |
| axios.toFormData = toFormData; |
|
|
| |
| axios.AxiosError = AxiosError; |
|
|
| |
| axios.Cancel = axios.CanceledError; |
|
|
| |
| axios.all = function all(promises) { |
| return Promise.all(promises); |
| }; |
|
|
| axios.spread = spread; |
|
|
| |
| axios.isAxiosError = isAxiosError; |
|
|
| |
| axios.mergeConfig = mergeConfig; |
|
|
| axios.AxiosHeaders = AxiosHeaders; |
|
|
| axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); |
|
|
| axios.getAdapter = adapters.getAdapter; |
|
|
| axios.HttpStatusCode = HttpStatusCode; |
|
|
| axios.default = axios; |
|
|
| |
| export default axios |
|
|