Socket
Socket
Sign inDemoInstall

axios

Package Overview
Dependencies
8
Maintainers
4
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.27.2 to 0.28.0

bin/check-build-version.js

179

CHANGELOG.md
# Changelog
### 0.27.2 (April 27, 2022)
## [0.28.0](https://github.com/axios/axios/compare/v0.27.2...v0.28.0) (2024-02-12)
## Release notes:
### Bug Fixes
* fix(security): fixed CVE-2023-45857 by backporting `withXSRFToken` option to v0.x (#6091)
### Backports from v1.x:
* Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
* Fixing content-type header repeated #4745
* Fixed timeout error message for HTTP 4738
* Added `axios.formToJSON` method (#4735)
* URL params serializer (#4734)
* Fixed toFormData Blob issue on node>v17 #4728
* Adding types for progress event callbacks #4675
* Fixed max body length defaults #4731
* Added data URL support for node.js (#4725)
* Added isCancel type assert (#4293)
* Added the ability for the `url-encoded-form` serializer to respect the `formSerializer` config (#4721)
* Add `string[]` to `AxiosRequestHeaders` type (#4322)
* Allow type definition for axios instance methods (#4224)
* Fixed `AxiosError` stack capturing; (#4718)
* Fixed `AxiosError` status code type; (#4717)
* Adding Canceler parameters config and request (#4711)
* fix(types): allow to specify partial default headers for instance creation (#4185)
* Added `blob` to the list of protocols supported by the browser (#4678)
* Fixing Z_BUF_ERROR when no content (#4701)
* Fixed race condition on immediate requests cancellation (#4261)
* Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an Axios instance https://github.com/axios/axios/pull/4248
* Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
* Fix TS definition for AxiosRequestTransformer (#4201)
* Use type alias instead of interface for AxiosPromise (#4505)
* Include request and config when creating a CanceledError instance (#4659)
* Added generic TS types for the exposed toFormData helper (#4668)
* Optimized the code that checks cancellation (#4587)
* Replaced webpack with rollup (#4596)
* Added stack trace to AxiosError (#4624)
* Updated AxiosError.config to be optional in the type definition (#4665)
* Removed incorrect argument for NetworkError constructor (#4656)
## 0.27.2 (April 27, 2022)
Fixes and Functionality:
- Fixed FormData posting in browser environment by reverting #3785 ([#4640](https://github.com/axios/axios/pull/4640))

@@ -10,11 +52,13 @@ - Enhanced protocol parsing implementation ([#4639](https://github.com/axios/axios/pull/4639))

### 0.27.1 (April 26, 2022)
## 0.27.1 (April 26, 2022)
Fixes and Functionality:
- Removed import of url module in browser build due to huge size overhead and builds being broken ([#4594](https://github.com/axios/axios/pull/4594))
- Bumped follow-redirects to ^1.14.9 ([#4615](https://github.com/axios/axios/pull/4615))
### 0.27.0 (April 25, 2022)
## 0.27.0 (April 25, 2022)
Breaking changes:
- New toFormData helper function that allows the implementor to pass an object and allow axios to convert it to FormData ([#3757](https://github.com/axios/axios/pull/3757))

@@ -27,5 +71,7 @@ - Removed functionality that removed the the `Content-Type` request header when passing FormData ([#3785](https://github.com/axios/axios/pull/3785))

QOL and DevX improvements:
- Added a multipart/form-data testing playground allowing contributors to debug changes easily ([#4465](https://github.com/axios/axios/pull/4465))
Fixes and Functionality:
- Refactored project file structure to avoid circular imports ([#4515](https://github.com/axios/axios/pull/4516)) & ([#4516](https://github.com/axios/axios/pull/4516))

@@ -35,18 +81,23 @@ - Bumped follow-redirects to ^1.14.9 ([#4562](https://github.com/axios/axios/pull/4562))

Internal and Tests:
- Updated dev dependencies to latest version
Documentation:
- Fixing incorrect link in changelog ([#4551](https://github.com/axios/axios/pull/4551))
Notes:
- **(*)** Please read these pull requests before updating, these changes are very impactful and far reaching.
### 0.26.1 (March 9, 2022)
## 0.26.1 (March 9, 2022)
Fixes and Functionality:
- Refactored project file structure to avoid circular imports ([#4220](https://github.com/axios/axios/pull/4220))
### 0.26.0 (February 13, 2022)
## 0.26.0 (February 13, 2022)
Fixes and Functionality:
- Fixed The timeoutErrorMessage property in config not work with Node.js ([#3581](https://github.com/axios/axios/pull/3581))

@@ -59,5 +110,6 @@ - Added errors to be displayed when the query parsing process itself fails ([#3961](https://github.com/axios/axios/pull/3961))

### 0.25.0 (January 18, 2022)
## 0.25.0 (January 18, 2022)
Breaking changes:
- Fixing maxBodyLength enforcement ([#3786](https://github.com/axios/axios/pull/3786))

@@ -71,2 +123,3 @@ - Don't rely on strict mode behavior for arguments ([#3470](https://github.com/axios/axios/pull/3470))

Fixes and Functionality:
- Added aborted even handler ([#3916](https://github.com/axios/axios/pull/3916))

@@ -82,2 +135,3 @@ - Header types expanded allowing `boolean` and `number` types ([#4144](https://github.com/axios/axios/pull/4144))

Internal and Tests:
- Adding axios-test-instance to ecosystem ([#3496](https://github.com/axios/axios/pull/3496))

@@ -89,2 +143,3 @@ - Optimize the logic of isAxiosError ([#3546](https://github.com/axios/axios/pull/3546))

Documentation:
- Fixing changelog to show correct pull request ([#4219](https://github.com/axios/axios/pull/4219))

@@ -117,5 +172,6 @@ - Update upgrade guide for https proxy setting ([#3604](https://github.com/axios/axios/pull/3604))

### 0.24.0 (October 25, 2021)
## 0.24.0 (October 25, 2021)
Breaking changes:
- Revert: change type of AxiosResponse to any, please read lengthy discussion here: ([#4141](https://github.com/axios/axios/issues/4141)) pull request: ([#4186](https://github.com/axios/axios/pull/4186))

@@ -130,5 +186,6 @@

### 0.23.0 (October 12, 2021)
## 0.23.0 (October 12, 2021)
Breaking changes:
- Distinguish request and response data types ([#4116](https://github.com/axios/axios/pull/4116))

@@ -139,2 +196,3 @@ - Change never type to unknown ([#4142](https://github.com/axios/axios/pull/4142))

Fixes and Functionality:
- Adding globalObject: 'this' to webpack config ([#3176](https://github.com/axios/axios/pull/3176))

@@ -146,2 +204,3 @@ - Adding insecureHTTPParser type to AxiosRequestConfig ([#4066](https://github.com/axios/axios/pull/4066))

Internal and Tests:
- Improve timeout error when timeout is browser default ([#3209](https://github.com/axios/axios/pull/3209))

@@ -152,2 +211,3 @@ - Fix node version on CI ([#4069](https://github.com/axios/axios/pull/4069))

Documentation:
- Rename Angular to AngularJS ([#4114](https://github.com/axios/axios/pull/4114))

@@ -166,5 +226,6 @@

### 0.22.0 (October 01, 2021)
## 0.22.0 (October 01, 2021)
Fixes and Functionality:
- Caseless header comparing in HTTP adapter ([#2880](https://github.com/axios/axios/pull/2880))

@@ -184,5 +245,6 @@ - Avoid package.json import fixing issues and warnings related to this ([#4041](https://github.com/axios/axios/pull/4041)), ([#4065](https://github.com/axios/axios/pull/4065))

### 0.21.4 (September 6, 2021)
## 0.21.4 (September 6, 2021)
Fixes and Functionality:
- Fixing JSON transform when data is stringified. Providing backward compatibility and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))

@@ -197,5 +259,6 @@

### 0.21.3 (September 4, 2021)
## 0.21.3 (September 4, 2021)
Fixes and Functionality:
- Fixing response interceptor not being called when request interceptor is attached ([#4013](https://github.com/axios/axios/pull/4013))

@@ -208,3 +271,3 @@

### 0.21.2 (September 4, 2021)
## 0.21.2 (September 4, 2021)

@@ -278,3 +341,3 @@ Fixes and Functionality:

### 0.21.1 (December 21, 2020)
## 0.21.1 (December 21, 2020)

@@ -302,3 +365,3 @@ Fixes and Functionality:

### 0.21.0 (October 23, 2020)
## 0.21.0 (October 23, 2020)

@@ -333,7 +396,7 @@ Fixes and Functionality:

### 0.20.0 (August 20, 2020)
## 0.20.0 (August 20, 2020)
Release of 0.20.0-pre as a full release with no other changes.
### 0.20.0-pre (July 15, 2020)
## 0.20.0-pre (July 15, 2020)

@@ -553,7 +616,7 @@ Fixes and Functionality:

### 0.19.2 (Jan 20, 2020)
## 0.19.2 (Jan 20, 2020)
- Remove unnecessary XSS check ([#2679](https://github.com/axios/axios/pull/2679)) (see ([#2646](https://github.com/axios/axios/issues/2646)) for discussion)
### 0.19.1 (Jan 7, 2020)
## 0.19.1 (Jan 7, 2020)

@@ -614,3 +677,3 @@ Fixes and Functionality:

### 0.19.0 (May 30, 2019)
## 0.19.0 (May 30, 2019)

@@ -654,7 +717,7 @@ Fixes and Functionality:

### 0.19.0-beta.1 (Aug 9, 2018)
## 0.19.0-beta.1 (Aug 9, 2018)
**NOTE:** This is a beta version of this release. There may be functionality that is broken in
certain browsers, though we suspect that builds are hanging and not erroring. See
https://saucelabs.com/u/axios for the most up-to-date information.
<https://saucelabs.com/u/axios> for the most up-to-date information.

@@ -724,3 +787,3 @@ New Functionality:

### 0.18.0 (Feb 19, 2018)
## 0.18.0 (Feb 19, 2018)

@@ -735,3 +798,3 @@ - Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))

### 0.17.1 (Nov 11, 2017)
## 0.17.1 (Nov 11, 2017)

@@ -742,3 +805,3 @@ - Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))

### 0.17.0 (Oct 21, 2017)
## 0.17.0 (Oct 21, 2017)

@@ -750,3 +813,3 @@ - **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))

### 0.16.2 (Jun 3, 2017)
## 0.16.2 (Jun 3, 2017)

@@ -757,3 +820,3 @@ - Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))

### 0.16.1 (Apr 8, 2017)
## 0.16.1 (Apr 8, 2017)

@@ -764,3 +827,3 @@ - Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))

### 0.16.0 (Mar 31, 2017)
## 0.16.0 (Mar 31, 2017)

@@ -774,3 +837,3 @@ - **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))

### 0.15.3 (Nov 27, 2016)
## 0.15.3 (Nov 27, 2016)

@@ -785,11 +848,11 @@ - Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))

### 0.15.2 (Oct 17, 2016)
## 0.15.2 (Oct 17, 2016)
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
### 0.15.1 (Oct 14, 2016)
## 0.15.1 (Oct 14, 2016)
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
### 0.15.0 (Oct 10, 2016)
## 0.15.0 (Oct 10, 2016)

@@ -801,3 +864,3 @@ - Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))

### 0.14.0 (Aug 27, 2016)
## 0.14.0 (Aug 27, 2016)

@@ -811,7 +874,7 @@ - **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))

### 0.13.1 (Jul 16, 2016)
## 0.13.1 (Jul 16, 2016)
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
### 0.13.0 (Jul 13, 2016)
## 0.13.0 (Jul 13, 2016)

@@ -826,3 +889,3 @@ - **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))

### 0.12.0 (May 31, 2016)
## 0.12.0 (May 31, 2016)

@@ -832,3 +895,3 @@ - Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))

### 0.11.1 (May 17, 2016)
## 0.11.1 (May 17, 2016)

@@ -839,3 +902,3 @@ - Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))

### 0.11.0 (Apr 26, 2016)
## 0.11.0 (Apr 26, 2016)

@@ -846,3 +909,3 @@ - Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))

### 0.10.0 (Apr 20, 2016)
## 0.10.0 (Apr 20, 2016)

@@ -858,3 +921,3 @@ - Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))

### 0.9.1 (Jan 24, 2016)
## 0.9.1 (Jan 24, 2016)

@@ -866,3 +929,3 @@ - Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))

### 0.9.0 (Jan 18, 2016)
## 0.9.0 (Jan 18, 2016)

@@ -875,3 +938,3 @@ - Adding support for custom adapters

### 0.8.1 (Dec 14, 2015)
## 0.8.1 (Dec 14, 2015)

@@ -882,3 +945,3 @@ - Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))

### 0.8.0 (Dec 11, 2015)
## 0.8.0 (Dec 11, 2015)

@@ -895,3 +958,3 @@ - Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))

### 0.7.0 (Sep 29, 2015)
## 0.7.0 (Sep 29, 2015)

@@ -906,3 +969,3 @@ - Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))

### 0.6.0 (Sep 21, 2015)
## 0.6.0 (Sep 21, 2015)

@@ -918,15 +981,15 @@ - Removing deprecated success/error aliases

### 0.5.4 (Apr 08, 2015)
## 0.5.4 (Apr 08, 2015)
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
### 0.5.3 (Apr 07, 2015)
## 0.5.3 (Apr 07, 2015)
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
### 0.5.2 (Mar 13, 2015)
## 0.5.2 (Mar 13, 2015)
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
### 0.5.1 (Mar 10, 2015)
## 0.5.1 (Mar 10, 2015)

@@ -936,3 +999,3 @@ - Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))

### 0.5.0 (Jan 23, 2015)
## 0.5.0 (Jan 23, 2015)

@@ -942,3 +1005,3 @@ - Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))

### 0.4.2 (Dec 10, 2014)
## 0.4.2 (Dec 10, 2014)

@@ -950,7 +1013,7 @@ - Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))

### 0.4.1 (Oct 15, 2014)
## 0.4.1 (Oct 15, 2014)
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
### 0.4.0 (Oct 03, 2014)
## 0.4.0 (Oct 03, 2014)

@@ -964,7 +1027,7 @@ - Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))

### 0.3.1 (Sep 16, 2014)
## 0.3.1 (Sep 16, 2014)
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
### 0.3.0 (Sep 16, 2014)
## 0.3.0 (Sep 16, 2014)

@@ -975,11 +1038,11 @@ - Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))

### 0.2.2 (Sep 14, 2014)
## 0.2.2 (Sep 14, 2014)
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
### 0.2.1 (Sep 12, 2014)
## 0.2.1 (Sep 12, 2014)
- Fixing build problem causing ridiculous file sizes
### 0.2.0 (Sep 12, 2014)
## 0.2.0 (Sep 12, 2014)

@@ -989,4 +1052,4 @@ - Adding support for `all` and `spread`

### 0.1.0 (Aug 29, 2014)
## 0.1.0 (Aug 29, 2014)
- Initial release

@@ -1,3 +0,2 @@

/* axios v0.27.2 | (c) 2022 by Matt Zabriskie */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}([function(e,t,n){"use strict";var r,o=n(4),i=Object.prototype.toString,s=(r=Object.create(null),function(e){var t=i.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return s(t)===e}}function u(e){return Array.isArray(e)}function c(e){return void 0===e}var f=a("ArrayBuffer");function l(e){return null!==e&&"object"==typeof e}function p(e){if("object"!==s(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var d=a("Date"),h=a("File"),m=a("Blob"),v=a("FileList");function y(e){return"[object Function]"===i.call(e)}var g=a("URLSearchParams");function E(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var b,O=(b="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return b&&e instanceof b});e.exports={isArray:u,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return e&&("function"==typeof FormData&&e instanceof FormData||"[object FormData]"===i.call(e)||y(e.toString)&&"[object FormData]"===e.toString())},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:l,isPlainObject:p,isUndefined:c,isDate:d,isFile:h,isBlob:m,isFunction:y,isStream:function(e){return l(e)&&y(e.pipe)},isURLSearchParams:g,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:E,merge:function e(){var t={};function n(n,r){p(t[r])&&p(n)?t[r]=e(t[r],n):p(n)?t[r]=e({},n):u(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)E(arguments[r],n);return t},extend:function(e,t,n){return E(t,(function(t,r){e[r]=n&&"function"==typeof t?o(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n){var r,o,i,s={};t=t||{};do{for(o=(r=Object.getOwnPropertyNames(e)).length;o-- >0;)s[i=r[o]]||(t[i]=e[i],s[i]=!0);e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;var t=e.length;if(c(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:O,isFileList:v}},function(e,t,n){"use strict";var r=n(0);function o(e,t,n,r,o){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}r.inherits(o,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var i=o.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){s[e]={value:e}})),Object.defineProperties(o,s),Object.defineProperty(i,"isAxiosError",{value:!0}),o.from=function(e,t,n,s,a,u){var c=Object.create(i);return r.toFlatObject(e,c,(function(e){return e!==Error.prototype})),o.call(c,e.message,t,n,s,a),c.name=e.name,u&&Object.assign(c,u),c},e.exports=o},function(e,t,n){"use strict";var r=n(1);function o(e){r.call(this,null==e?"canceled":e,r.ERR_CANCELED),this.name="CanceledError"}n(0).inherits(o,r,{__CANCEL__:!0}),e.exports=o},function(e,t,n){"use strict";var r=n(0),o=n(19),i=n(1),s=n(6),a=n(7),u={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var f,l={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(f=n(8)),f),transformRequest:[function(e,t){if(o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e))return e;if(r.isArrayBufferView(e))return e.buffer;if(r.isURLSearchParams(e))return c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var n,i=r.isObject(e),s=t&&t["Content-Type"];if((n=r.isFileList(e))||i&&"multipart/form-data"===s){var u=this.env&&this.env.FormData;return a(n?{"files[]":e}:e,u&&new u)}return i||"application/json"===s?(c(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||l.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||o&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw i.from(e,i.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:n(27)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){l.headers[e]=r.merge(u)})),e.exports=l},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(0);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t){t=t||new FormData;var n=[];function o(e){return null===e?"":r.isDate(e)?e.toISOString():r.isArrayBuffer(e)||r.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(i,s){if(r.isPlainObject(i)||r.isArray(i)){if(-1!==n.indexOf(i))throw Error("Circular reference detected in "+s);n.push(i),r.forEach(i,(function(n,i){if(!r.isUndefined(n)){var a,u=s?s+"."+i:i;if(n&&!s&&"object"==typeof n)if(r.endsWith(i,"{}"))n=JSON.stringify(n);else if(r.endsWith(i,"[]")&&(a=r.toArray(n)))return void a.forEach((function(e){!r.isUndefined(e)&&t.append(u,o(e))}));e(n,u)}})),n.pop()}else t.append(s,o(i))}(e),t}},function(e,t,n){"use strict";var r=n(0),o=n(20),i=n(21),s=n(5),a=n(9),u=n(24),c=n(25),f=n(6),l=n(1),p=n(2),d=n(26);e.exports=function(e){return new Promise((function(t,n){var h,m=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(m)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var E=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",O=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+O)}var x=a(e.baseURL,e.url);function w(){if(E){var r="getAllResponseHeaders"in E?u(E.getAllResponseHeaders()):null,i={data:y&&"text"!==y&&"json"!==y?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:r,config:e,request:E};o((function(e){t(e),g()}),(function(e){n(e),g()}),i),E=null}}if(E.open(e.method.toUpperCase(),s(x,e.params,e.paramsSerializer),!0),E.timeout=e.timeout,"onloadend"in E?E.onloadend=w:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&0===E.responseURL.indexOf("file:"))&&setTimeout(w)},E.onabort=function(){E&&(n(new l("Request aborted",l.ECONNABORTED,e,E)),E=null)},E.onerror=function(){n(new l("Network Error",l.ERR_NETWORK,e,E,E)),E=null},E.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new l(t,r.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,e,E)),E=null},r.isStandardBrowserEnv()){var R=(e.withCredentials||c(x))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;R&&(v[e.xsrfHeaderName]=R)}"setRequestHeader"in E&&r.forEach(v,(function(e,t){void 0===m&&"content-type"===t.toLowerCase()?delete v[t]:E.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(E.withCredentials=!!e.withCredentials),y&&"json"!==y&&(E.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&E.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&E.upload&&E.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){E&&(n(!e||e&&e.type?new p:e),E.abort(),E=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),m||(m=null);var S=d(x);S&&-1===["http","https","file"].indexOf(S)?n(new l("Unsupported protocol "+S+":",l.ERR_BAD_REQUEST,e)):E.send(m)}))}},function(e,t,n){"use strict";var r=n(22),o=n(23);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t){t=t||{};var n={};function o(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function i(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:o(void 0,e[n]):o(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return o(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:o(void 0,e[n]):o(void 0,t[n])}function u(n){return n in t?o(e[n],t[n]):n in e?o(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,o=t(e);r.isUndefined(o)&&t!==u||(n[e]=o)})),n}},function(e,t){e.exports={version:"0.27.2"}},function(e,t,n){e.exports=n(14)},function(e,t,n){"use strict";var r=n(0),o=n(4),i=n(15),s=n(11);var a=function e(t){var n=new i(t),a=o(i.prototype.request,n);return r.extend(a,i.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(3));a.Axios=i,a.CanceledError=n(2),a.CancelToken=n(29),a.isCancel=n(10),a.VERSION=n(12).version,a.toFormData=n(7),a.AxiosError=n(1),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=n(30),a.isAxiosError=n(31),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(0),o=n(5),i=n(16),s=n(17),a=n(11),u=n(9),c=n(28),f=c.validators;function l(e){this.defaults=e,this.interceptors={request:new i,response:new i}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&c.assertOptions(n,{silentJSONParsing:f.transitional(f.boolean),forcedJSONParsing:f.transitional(f.boolean),clarifyTimeoutError:f.transitional(f.boolean)},!1);var r=[],o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var i,u=[];if(this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)})),!o){var l=[s,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(u),i=Promise.resolve(t);l.length;)i=i.then(l.shift(),l.shift());return i}for(var p=t;r.length;){var d=r.shift(),h=r.shift();try{p=d(p)}catch(e){h(e);break}}try{i=s(p)}catch(e){return Promise.reject(e)}for(;u.length;)i=i.then(u.shift(),u.shift());return i},l.prototype.getUri=function(e){e=a(this.defaults,e);var t=u(e.baseURL,e.url);return o(t,e.params,e.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(a(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}l.prototype[e]=t(),l.prototype[e+"Form"]=t(!0)})),e.exports=l},function(e,t,n){"use strict";var r=n(0);function o(){this.handlers=[]}o.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,n){"use strict";var r=n(0),o=n(18),i=n(10),s=n(3),a=n(2);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(u(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(0),o=n(3);e.exports=function(e,t,n){var i=this||o;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(0),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},function(e,t){e.exports=null},function(e,t,n){"use strict";var r=n(12).version,o=n(1),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var s={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new o(i(r," has been removed"+(t?" in "+t:"")),o.ERR_DEPRECATED);return t&&!s[r]&&(s[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new o("options must be an object",o.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),i=r.length;i-- >0;){var s=r[i],a=t[s];if(a){var u=e[s],c=void 0===u||a(u,s,e);if(!0!==c)throw new o("option "+s+" must be "+c,o.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new o("Unknown option "+s,o.ERR_BAD_OPTION)}},validators:i}},function(e,t,n){"use strict";var r=n(2);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},o.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}}])}));
//# sourceMappingURL=axios.min.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";var e,t=function(e,t){return function(){return e.apply(t,arguments)}},r=Object.prototype.toString,n=(e=Object.create(null),function(t){var n=r.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())});function o(e){return e=e.toLowerCase(),function(t){return n(t)===e}}function i(e){return Array.isArray(e)}function s(e){return void 0===e}var a=o("ArrayBuffer");function u(e){return"number"==typeof e}function c(e){return null!==e&&"object"==typeof e}function f(e){if("object"!==n(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var l=o("Date"),p=o("File"),d=o("Blob"),h=o("FileList");function m(e){return"[object Function]"===r.call(e)}var y=o("URLSearchParams");function v(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var b,E=(b="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return b&&e instanceof b});var g,w=o("HTMLFormElement"),O=(g=Object.prototype.hasOwnProperty,function(e,t){return g.call(e,t)}),R={isArray:i,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||r.call(e)===t||m(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:u,isObject:c,isPlainObject:f,isEmptyObject:function(e){return e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype},isUndefined:s,isDate:l,isFile:p,isBlob:d,isFunction:m,isStream:function(e){return c(e)&&m(e.pipe)},isURLSearchParams:y,isStandardBrowserEnv:function(){var e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:v,merge:function e(){var t={};function r(r,n){f(t[n])&&f(r)?t[n]=e(t[n],r):f(r)?t[n]=e({},r):i(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)v(arguments[n],r);return t},extend:function(e,r,n){return v(r,(function(r,o){e[o]=n&&"function"==typeof r?t(r,n):r})),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,s,a={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)s=o[i],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:n,kindOfTest:o,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(i(e))return e;var t=e.length;if(!u(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:E,isFileList:h,forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:w,hasOwnProperty:O};function S(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}R.inherits(S,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var T=S.prototype,A={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){A[e]={value:e}})),Object.defineProperties(S,A),Object.defineProperty(T,"isAxiosError",{value:!0}),S.from=function(e,t,r,n,o,i){var s=Object.create(T);return R.toFlatObject(e,s,(function(e){return e!==Error.prototype})),S.call(s,e.message,t,r,n,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};var j=S,x="object"==typeof self?self.FormData:window.FormData;function N(e){return R.isPlainObject(e)||R.isArray(e)}function _(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function P(e,t,r){return e?e.concat(t).map((function(e,t){return e=_(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var B=R.toFlatObject(R,{},null,(function(e){return/^is[A-Z]/.test(e)}));var C=function(e,t,r){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new(x||FormData);var n,o=(r=R.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!R.isUndefined(t[e])}))).metaTokens,i=r.visitor||f,s=r.dots,a=r.indexes,u=(r.Blob||"undefined"!=typeof Blob&&Blob)&&((n=t)&&R.isFunction(n.append)&&"FormData"===n[Symbol.toStringTag]&&n[Symbol.iterator]);if(!R.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(R.isDate(e))return e.toISOString();if(!u&&R.isBlob(e))throw new j("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(e)||R.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function f(e,r,n){var i=e;if(e&&!n&&"object"==typeof e)if(R.endsWith(r,"{}"))r=o?r:r.slice(0,-2),e=JSON.stringify(e);else if(R.isArray(e)&&function(e){return R.isArray(e)&&!e.some(N)}(e)||R.isFileList(e)||R.endsWith(r,"[]")&&(i=R.toArray(e)))return r=_(r),i.forEach((function(e,n){!R.isUndefined(e)&&t.append(!0===a?P([r],n,s):null===a?r:r+"[]",c(e))})),!1;return!!N(e)||(t.append(P(n,r,s),c(e)),!1)}var l=[],p=Object.assign(B,{defaultVisitor:f,convertValue:c,isVisitable:N});if(!R.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!R.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),R.forEach(r,(function(r,o){!0===(!R.isUndefined(r)&&i.call(t,r,R.isString(o)?o.trim():o,n,p))&&e(r,n?n.concat(o):[o])})),l.pop()}}(e),t};function F(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,(function(e){return t[e]}))}function U(e,t){this._pairs=[],e&&C(e,this,t)}var D=U.prototype;D.append=function(e,t){this._pairs.push([e,t])},D.toString=function(e){var t=e?function(t){return e.call(this,t,F)}:F;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var L=U;function k(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var q=function(e,t,r){if(!t)return e;var n=e.indexOf("#");-1!==n&&(e=e.slice(0,n));var o=r&&r.encode||k,i=R.isURLSearchParams(t)?t.toString():new L(t,r).toString(o);return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e};function I(){this.handlers=[]}I.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},I.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},I.prototype.clear=function(){this.handlers&&(this.handlers=[])},I.prototype.forEach=function(e){R.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var M=I,H=function(e,t){R.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},J={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:L,FormData:FormData,Blob:Blob},protocols:["http","https","file","blob","url","data"]};var V=function(e){function t(e,r,n,o){var i=e[o++],s=Number.isFinite(+i),a=o>=e.length;return i=!i&&R.isArray(n)?n.length:i,a?(R.hasOwnProperty(n,i)?n[i]=[n[i],r]:n[i]=r,!s):(n[i]&&R.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&R.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t<i;t++)n[r=o[t]]=e[r];return n}(n[i])),!s)}if(R.isFormData(e)&&R.isFunction(e.entries)){var r={};return R.forEachEntry(e,(function(e,n){t(function(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map((function(e){return"[]"===e[0]?"":e[1]||e[0]}))}(e),n,r,0)})),r}return null},W=R.isStandardBrowserEnv()?{write:function(e,t,r,n,o,i){var s=[];s.push(e+"="+encodeURIComponent(t)),R.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),R.isString(n)&&s.push("path="+n),R.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},X=function(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},K=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],$=R.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=R.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0};function Q(e,t,r){j.call(this,null==e?"canceled":e,j.ERR_CANCELED,t,r),this.name="CanceledError"}R.inherits(Q,j,{__CANCEL__:!0});var G=Q,Y=function(e){return new Promise((function(t,r){var n,o=e.data,i=e.headers,s=e.responseType,a=e.withXSRFToken;function u(){e.cancelToken&&e.cancelToken.unsubscribe(n),e.signal&&e.signal.removeEventListener("abort",n)}R.isFormData(o)&&R.isStandardBrowserEnv()&&delete i["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",l=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(f+":"+l)}var p=X(e.baseURL,e.url);function d(){if(c){var n,o,i,a,f,l="getAllResponseHeaders"in c?(n=c.getAllResponseHeaders(),f={},n?(R.forEach(n.split("\n"),(function(e){if(a=e.indexOf(":"),o=R.trim(e.slice(0,a)).toLowerCase(),i=R.trim(e.slice(a+1)),o){if(f[o]&&K.indexOf(o)>=0)return;f[o]="set-cookie"===o?(f[o]?f[o]:[]).concat([i]):f[o]?f[o]+", "+i:i}})),f):f):null;!function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new j("Request failed with status code "+r.status,[j.ERR_BAD_REQUEST,j.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),u()}),(function(e){r(e),u()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:l,config:e,request:c}),c=null}}if(c.open(e.method.toUpperCase(),q(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(r(new j("Request aborted",j.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new j("Network Error",j.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new j(t,n.clarifyTimeoutError?j.ETIMEDOUT:j.ECONNABORTED,e,c)),c=null},R.isStandardBrowserEnv()&&(a&&R.isFunction(a)&&(a=a(e)),a||!1!==a&&$(p))){var h=e.xsrfHeaderName&&e.xsrfCookieName&&W.read(e.xsrfCookieName);h&&(i[e.xsrfHeaderName]=h)}"setRequestHeader"in c&&R.forEach(i,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete i[t]:c.setRequestHeader(t,e)})),R.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(n=function(t){c&&(r(!t||t.type?new G(null,e,req):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(n),e.signal&&(e.signal.aborted?n():e.signal.addEventListener("abort",n))),o||!1===o||0===o||""===o||(o=null);var m,y=(m=/^([-+\w]{1,25})(:?\/\/|:)/.exec(p))&&m[1]||"";y&&-1===J.protocols.indexOf(y)?r(new j("Unsupported protocol "+y+":",j.ERR_BAD_REQUEST,e)):c.send(o)}))},Z={"Content-Type":"application/x-www-form-urlencoded"};function ee(e,t){!R.isUndefined(e)&&R.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var te,re={transitional:z,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(te=Y),te),transformRequest:[function(e,t){H(t,"Accept"),H(t,"Content-Type");var r,n=t&&t["Content-Type"]||"",o=n.indexOf("application/json")>-1,i=R.isObject(e);if(i&&R.isHTMLForm(e)&&(e=new FormData(e)),R.isFormData(e))return o?JSON.stringify(V(e)):e;if(R.isArrayBuffer(e)||R.isBuffer(e)||R.isStream(e)||R.isFile(e)||R.isBlob(e))return e;if(R.isArrayBufferView(e))return e.buffer;if(R.isURLSearchParams(e))return ee(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(i){if(-1!==n.indexOf("application/x-www-form-urlencoded"))return function(e,t){return C(e,new J.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return J.isNode&&R.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=R.isFileList(e))||n.indexOf("multipart/form-data")>-1){var s=this.env&&this.env.FormData;return C(r?{"files[]":e}:e,s&&new s,this.formSerializer)}}return i||o?(ee(t,"application/json"),function(e,t,r){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||re.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&R.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw j.from(e,j.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J.classes.FormData,Blob:J.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};R.forEach(["delete","get","head"],(function(e){re.headers[e]={}})),R.forEach(["post","put","patch"],(function(e){re.headers[e]=R.merge(Z)}));var ne=re,oe=function(e,t,r,n){var o=this||ne;return R.forEach(n,(function(n){e=n.call(o,e,t,r)})),e},ie=function(e){return!(!e||!e.__CANCEL__)};function se(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G}var ae=function(e){return se(e),e.headers=e.headers||{},e.data=oe.call(e,e.data,e.headers,null,e.transformRequest),H(e.headers,"Accept"),H(e.headers,"Content-Type"),e.headers=R.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),R.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ne.adapter)(e).then((function(t){return se(e),t.data=oe.call(e,t.data,t.headers,t.status,e.transformResponse),t}),(function(t){return ie(t)||(se(e),t&&t.response&&(t.response.data=oe.call(e,t.response.data,t.response.headers,t.response.status,e.transformResponse))),Promise.reject(t)}))},ue=function(e,t){t=t||{};var r={};function n(e,t){return R.isPlainObject(e)&&R.isPlainObject(t)?R.merge(e,t):R.isEmptyObject(t)?R.merge({},e):R.isPlainObject(t)?R.merge({},t):R.isArray(t)?t.slice():t}function o(r){return R.isUndefined(t[r])?R.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function i(e){if(!R.isUndefined(t[e]))return n(void 0,t[e])}function s(r){return R.isUndefined(t[r])?R.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return R.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,n=t(e);R.isUndefined(n)&&t!==a||(r[e]=n)})),r},ce="0.28.0",fe=ce,le={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){le[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var pe={};le.transitional=function(e,t,r){function n(e,t){return"[Axios v"+fe+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new j(n(o," has been removed"+(t?" in "+t:"")),j.ERR_DEPRECATED);return t&&!pe[o]&&(pe[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var de={assertOptions:function(e,t,r){if("object"!=typeof e)throw new j("options must be an object",j.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],s=t[i];if(s){var a=e[i],u=void 0===a||s(a,i,e);if(!0!==u)throw new j("option "+i+" must be "+u,j.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new j("Unknown option "+i,j.ERR_BAD_OPTION)}},validators:le},he=de.validators;function me(e){this.defaults=e,this.interceptors={request:new M,response:new M}}me.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=ue(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&de.assertOptions(r,{silentJSONParsing:he.transitional(he.boolean),forcedJSONParsing:he.transitional(he.boolean),clarifyTimeoutError:he.transitional(he.boolean)},!1);var n=t.paramsSerializer;R.isFunction(n)&&(t.paramsSerializer={serialize:n});var o=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));var s,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!i){var u=[ae,void 0];for(Array.prototype.unshift.apply(u,o),u=u.concat(a),s=Promise.resolve(t);u.length;)s=s.then(u.shift(),u.shift());return s}for(var c=t;o.length;){var f=o.shift(),l=o.shift();try{c=f(c)}catch(e){l(e);break}}try{s=ae(c)}catch(e){return Promise.reject(e)}for(;a.length;)s=s.then(a.shift(),a.shift());return s},me.prototype.getUri=function(e){e=ue(this.defaults,e);var t=X(e.baseURL,e.url);return q(t,e.params,e.paramsSerializer)},R.forEach(["delete","get","head","options"],(function(e){me.prototype[e]=function(t,r){return this.request(ue(r||{},{method:e,url:t,data:(r||{}).data}))}})),R.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(ue(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}me.prototype[e]=t(),me.prototype[e+"Form"]=t(!0)}));var ye=me;function ve(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){for(var t=r._listeners.length;t-- >0;)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,o){r.reason||(r.reason=new G(e,n,o),t(r.reason))}))}ve.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ve.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},ve.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},ve.source=function(){var e;return{token:new ve((function(t){e=t})),cancel:e}};var be=ve;var Ee=function e(r){var n=new ye(r),o=t(ye.prototype.request,n);return R.extend(o,ye.prototype,n),R.extend(o,n),o.create=function(t){return e(ue(r,t))},o}(ne);Ee.Axios=ye,Ee.CanceledError=G,Ee.CancelToken=be,Ee.isCancel=ie,Ee.VERSION=ce,Ee.toFormData=C,Ee.AxiosError=j,Ee.Cancel=Ee.CanceledError,Ee.all=function(e){return Promise.all(e)},Ee.spread=function(e){return function(t){return e.apply(null,t)}},Ee.isAxiosError=function(e){return R.isObject(e)&&!0===e.isAxiosError},Ee.formToJSON=function(e){return V(R.isHTMLForm(e)?new FormData(e):e)};var ge=Ee,we=Ee;return ge.default=we,ge}));
//# sourceMappingURL=axios.min.js.map

@@ -1,5 +0,17 @@

// TypeScript Version: 3.0
export type AxiosRequestHeaders = Record<string, string | number | boolean>;
// TypeScript Version: 4.1
type HeaderValue = string | string[] | number | boolean;
export type AxiosResponseHeaders = Record<string, string> & {
type AxiosHeaders = Record<string, HeaderValue | Record<Method & CommonHeaders, HeaderValue>>;
type MethodsHeaders = {
[Key in Method as Lowercase<Key>]: AxiosHeaders;
};
interface CommonHeaders {
common: AxiosHeaders;
}
export type AxiosRequestHeaders = Partial<AxiosHeaders & MethodsHeaders & CommonHeaders>;
export type AxiosResponseHeaders = Partial<Record<string, string>> & {
"set-cookie"?: string[]

@@ -9,7 +21,7 @@ };

export interface AxiosRequestTransformer {
(data: any, headers?: AxiosRequestHeaders): any;
(data: any, headers: AxiosRequestHeaders): any;
}
export interface AxiosResponseTransformer {
(data: any, headers?: AxiosResponseHeaders): any;
(data: any, headers?: AxiosResponseHeaders, status?: number): any;
}

@@ -76,2 +88,48 @@

export interface GenericAbortSignal {
aborted: boolean;
onabort: ((...args: any) => any) | null;
addEventListener: (...args: any) => any;
removeEventListener: (...args: any) => any;
}
export interface FormDataVisitorHelpers {
defaultVisitor: SerializerVisitor;
convertValue: (value: any) => any;
isVisitable: (value: any) => boolean;
}
export interface SerializerVisitor {
(
this: GenericFormData,
value: any,
key: string | number,
path: null | Array<string | number>,
helpers: FormDataVisitorHelpers
): boolean;
}
export interface SerializerOptions {
visitor?: SerializerVisitor;
dots?: boolean;
metaTokens?: boolean;
indexes?: boolean | null;
}
// tslint:disable-next-line
export interface FormSerializerOptions extends SerializerOptions {
}
export interface ParamEncoder {
(value: any, defaultEncoder: (value: any) => any): any;
}
export interface CustomParamsSerializer {
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
}
export interface ParamsSerializerOptions extends SerializerOptions {
encode?: ParamEncoder;
}
export interface AxiosRequestConfig<D = any> {

@@ -85,3 +143,3 @@ url?: string;

params?: any;
paramsSerializer?: (params: any) => string;
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
data?: D;

@@ -97,4 +155,4 @@ timeout?: number;

xsrfHeaderName?: string;
onUploadProgress?: (progressEvent: any) => void;
onDownloadProgress?: (progressEvent: any) => void;
onUploadProgress?: (progressEvent: ProgressEvent) => void;
onDownloadProgress?: (progressEvent: ProgressEvent) => void;
maxContentLength?: number;

@@ -112,3 +170,3 @@ validateStatus?: ((status: number) => boolean) | null;

transitional?: TransitionalOptions;
signal?: AbortSignal;
signal?: GenericAbortSignal;
insecureHTTPParser?: boolean;

@@ -118,2 +176,4 @@ env?: {

};
formSerializer?: FormSerializerOptions;
withXSRFToken?: boolean | ((config: AxiosRequestConfig) => boolean | undefined);
}

@@ -139,2 +199,6 @@

export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers?: AxiosRequestHeaders | Partial<HeadersDefaults>;
}
export interface AxiosResponse<T = any, D = any> {

@@ -158,3 +222,3 @@ data: T;

config: AxiosRequestConfig<D>;
config?: AxiosRequestConfig<D>;
code?: string;

@@ -164,4 +228,5 @@ request?: any;

isAxiosError: boolean;
status?: string;
status?: number;
toJSON: () => object;
cause?: Error;
static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";

@@ -174,2 +239,4 @@ static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";

static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
static readonly ERR_CANCELED = "ERR_CANCELED";

@@ -183,4 +250,3 @@ static readonly ECONNABORTED = "ECONNABORTED";

export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
}
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;

@@ -196,3 +262,3 @@ export interface CancelStatic {

export interface Canceler {
(message?: string): void;
(message?: string, config?: AxiosRequestConfig, request?: any): void;
}

@@ -248,16 +314,35 @@

export interface AxiosInstance extends Axios {
(config: AxiosRequestConfig): AxiosPromise;
(url: string, config?: AxiosRequestConfig): AxiosPromise;
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): AxiosPromise<R>;
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): AxiosPromise<R>;
defaults: Omit<AxiosDefaults, 'headers'> & {
headers: HeadersDefaults & {
[key: string]: string | number | boolean | undefined
}
};
}
export interface GenericFormData {
append(name: string, value: any, options?: any): any;
}
export interface GenericHTMLFormElement {
name: string;
method: string;
submit(): void;
}
export interface AxiosStatic extends AxiosInstance {
create(config?: AxiosRequestConfig): AxiosInstance;
create(config?: CreateAxiosDefaults): AxiosInstance;
Cancel: CancelStatic;
CancelToken: CancelTokenStatic;
Axios: typeof Axios;
AxiosError: typeof AxiosError;
readonly VERSION: string;
isCancel(value: any): boolean;
isCancel(value: any): value is Cancel;
all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
isAxiosError(payload: any): payload is AxiosError;
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
}

@@ -264,0 +349,0 @@

@@ -7,6 +7,7 @@ 'use strict';

var buildURL = require('./../helpers/buildURL');
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
var http = require('http');
var https = require('https');
var httpFollow = require('follow-redirects').http;
var httpsFollow = require('follow-redirects').https;
var httpFollow = require('follow-redirects/http');
var httpsFollow = require('follow-redirects/https');
var url = require('url');

@@ -18,29 +19,64 @@ var zlib = require('zlib');

var CanceledError = require('../cancel/CanceledError');
var platform = require('../platform');
var fromDataURI = require('../helpers/fromDataURI');
var stream = require('stream');
var isHttps = /https:?/;
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
var supportedProtocols = platform.protocols.map(function(protocol) {
return protocol + ':';
});
function dispatchBeforeRedirect(options) {
if (options.beforeRedirects.proxy) {
options.beforeRedirects.proxy(options);
}
if (options.beforeRedirects.config) {
options.beforeRedirects.config(options);
}
}
/**
*
* @param {http.ClientRequestArgs} options
* @param {AxiosProxyConfig} proxy
* @param {AxiosProxyConfig} configProxy
* @param {string} location
*/
function setProxy(options, proxy, location) {
options.hostname = proxy.host;
options.host = proxy.host;
options.port = proxy.port;
options.path = location;
function setProxy(options, configProxy, location) {
var proxy = configProxy;
if (!proxy && proxy !== false) {
var proxyUrl = getProxyForUrl(location);
if (proxyUrl) {
proxy = url.parse(proxyUrl);
// replace 'host' since the proxy object is not a URL object
proxy.host = proxy.hostname;
}
}
if (proxy) {
// Basic proxy authorization
if (proxy.auth) {
// Support proxy auth object form
if (proxy.auth.username || proxy.auth.password) {
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
}
var base64 = Buffer
.from(proxy.auth, 'utf8')
.toString('base64');
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
}
// Basic proxy authorization
if (proxy.auth) {
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
options.hostname = proxy.host;
options.host = proxy.host;
options.port = proxy.port;
options.path = location;
if (proxy.protocol) {
options.protocol = proxy.protocol;
}
}
// If a proxy is used, any redirects must also pass through the proxy
options.beforeRedirect = function beforeRedirect(redirection) {
redirection.headers.host = redirection.host;
setProxy(redirection, proxy, redirection.href);
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
// Configure proxy for redirected request, passing the original config proxy to apply
// the exact same logic as if the redirected request was performed by axios directly.
setProxy(redirectOptions, configProxy, redirectOptions.href);
};

@@ -73,2 +109,58 @@ }

var data = config.data;
var responseType = config.responseType;
var responseEncoding = config.responseEncoding;
var method = config.method.toUpperCase();
// Parse url
var fullPath = buildFullPath(config.baseURL, config.url);
var parsed = url.parse(fullPath);
var protocol = parsed.protocol || supportedProtocols[0];
if (protocol === 'data:') {
var convertedData;
if (method !== 'GET') {
return settle(resolve, reject, {
status: 405,
statusText: 'method not allowed',
headers: {},
config: config
});
}
try {
convertedData = fromDataURI(config.url, responseType === 'blob', {
Blob: config.env && config.env.Blob
});
} catch (err) {
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
}
if (responseType === 'text') {
convertedData = convertedData.toString(responseEncoding);
if (!responseEncoding || responseEncoding === 'utf8') {
data = utils.stripBOM(convertedData);
}
} else if (responseType === 'stream') {
convertedData = stream.Readable.from(convertedData);
}
return settle(resolve, reject, {
data: convertedData,
status: 200,
statusText: 'OK',
headers: {},
config: config
});
}
if (supportedProtocols.indexOf(protocol) === -1) {
return reject(new AxiosError(
'Unsupported protocol ' + protocol,
AxiosError.ERR_BAD_REQUEST,
config
));
}
var headers = config.headers;

@@ -134,15 +226,2 @@ var headerNames = {};

// Parse url
var fullPath = buildFullPath(config.baseURL, config.url);
var parsed = url.parse(fullPath);
var protocol = parsed.protocol || supportedProtocols[0];
if (supportedProtocols.indexOf(protocol) === -1) {
return reject(new AxiosError(
'Unsupported protocol ' + protocol,
AxiosError.ERR_BAD_REQUEST,
config
));
}
if (!auth && parsed.auth) {

@@ -159,5 +238,2 @@ var urlAuth = parsed.auth.split(':');

var isHttpsRequest = isHttps.test(protocol);
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
try {

@@ -175,7 +251,9 @@ buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, '');

path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
method: config.method.toUpperCase(),
method: method,
headers: headers,
agent: agent,
agents: { http: config.httpAgent, https: config.httpsAgent },
auth: auth
auth: auth,
protocol: protocol,
beforeRedirect: dispatchBeforeRedirect,
beforeRedirects: {}
};

@@ -188,63 +266,12 @@

options.port = parsed.port;
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
}
var proxy = config.proxy;
if (!proxy && proxy !== false) {
var proxyEnv = protocol.slice(0, -1) + '_proxy';
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
if (proxyUrl) {
var parsedProxyUrl = url.parse(proxyUrl);
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
var shouldProxy = true;
if (noProxyEnv) {
var noProxy = noProxyEnv.split(',').map(function trim(s) {
return s.trim();
});
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
if (!proxyElement) {
return false;
}
if (proxyElement === '*') {
return true;
}
if (proxyElement[0] === '.' &&
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
return true;
}
return parsed.hostname === proxyElement;
});
}
if (shouldProxy) {
proxy = {
host: parsedProxyUrl.hostname,
port: parsedProxyUrl.port,
protocol: parsedProxyUrl.protocol
};
if (parsedProxyUrl.auth) {
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
proxy.auth = {
username: proxyUrlAuth[0],
password: proxyUrlAuth[1]
};
}
}
}
}
if (proxy) {
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
}
var transport;
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
var isHttpsRequest = isHttps.test(options.protocol);
options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
if (config.transport) {
transport = config.transport;
} else if (config.maxRedirects === 0) {
transport = isHttpsProxy ? https : http;
transport = isHttpsRequest ? https : http;
} else {

@@ -255,5 +282,5 @@ if (config.maxRedirects) {

if (config.beforeRedirect) {
options.beforeRedirect = config.beforeRedirect;
options.beforeRedirects.config = config.beforeRedirect;
}
transport = isHttpsProxy ? httpsFollow : httpFollow;
transport = isHttpsRequest ? httpsFollow : httpFollow;
}

@@ -263,2 +290,5 @@

options.maxBodyLength = config.maxBodyLength;
} else {
// follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
options.maxBodyLength = Infinity;
}

@@ -275,3 +305,3 @@

// uncompress the response body transparently if required
var stream = res;
var responseStream = res;

@@ -281,5 +311,10 @@ // return the last request in case of redirects

// if decompress disabled we should not decompress
if (config.decompress !== false) {
// if no content, but headers still say that it is encoded,
// remove the header not confuse downstream operations
if (data && data.length === 0 && res.headers['content-encoding']) {
delete res.headers['content-encoding'];
}
// if no content, is HEAD request or decompress disabled we should not decompress
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
switch (res.headers['content-encoding']) {

@@ -290,4 +325,4 @@ /*eslint default-case:0*/

case 'deflate':
// add the unzipper to the body stream processing pipeline
stream = stream.pipe(zlib.createUnzip());
// add the unzipper to the body stream processing pipeline
responseStream = responseStream.pipe(zlib.createUnzip());

@@ -308,4 +343,4 @@ // remove the content-encoding in order to not confuse downstream operations

if (config.responseType === 'stream') {
response.data = stream;
if (responseType === 'stream') {
response.data = responseStream;
settle(resolve, reject, response);

@@ -315,3 +350,3 @@ } else {

var totalResponseBytes = 0;
stream.on('data', function handleStreamData(chunk) {
responseStream.on('data', function handleStreamData(chunk) {
responseBuffer.push(chunk);

@@ -322,5 +357,5 @@ totalResponseBytes += chunk.length;

if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
// stream.destoy() emit aborted event before calling reject() on Node.js v16
// stream.destroy() emit aborted event before calling reject() on Node.js v16
rejected = true;
stream.destroy();
responseStream.destroy();
reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',

@@ -331,7 +366,7 @@ AxiosError.ERR_BAD_RESPONSE, config, lastRequest));

stream.on('aborted', function handlerStreamAborted() {
responseStream.on('aborted', function handlerStreamAborted() {
if (rejected) {
return;
}
stream.destroy();
responseStream.destroy();
reject(new AxiosError(

@@ -345,3 +380,3 @@ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',

stream.on('error', function handleStreamError(err) {
responseStream.on('error', function handleStreamError(err) {
if (req.aborted) return;

@@ -351,8 +386,8 @@ reject(AxiosError.from(err, null, config, lastRequest));

stream.on('end', function handleStreamEnd() {
responseStream.on('end', function handleStreamEnd() {
try {
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
if (config.responseType !== 'arraybuffer') {
responseData = responseData.toString(config.responseEncoding);
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
if (responseType !== 'arraybuffer') {
responseData = responseData.toString(responseEncoding);
if (!responseEncoding || responseEncoding === 'utf8') {
responseData = utils.stripBOM(responseData);

@@ -402,9 +437,13 @@ }

// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
// And then these socket which be hang up will devoring CPU little by little.
// And then these socket which be hang up will devouring CPU little by little.
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
req.setTimeout(timeout, function handleRequestTimeout() {
req.abort();
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
var transitional = config.transitional || transitionalDefaults;
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}
reject(new AxiosError(
'timeout of ' + timeout + 'ms exceeded',
timeoutErrorMessage,
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,

@@ -424,3 +463,3 @@ config,

req.abort();
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
reject(!cancel || cancel.type ? new CanceledError(null, config, req) : cancel);
};

@@ -427,0 +466,0 @@

@@ -14,2 +14,3 @@ 'use strict';

var parseProtocol = require('../helpers/parseProtocol');
var platform = require('../platform');

@@ -21,2 +22,3 @@ module.exports = function xhrAdapter(config) {

var responseType = config.responseType;
var withXSRFToken = config.withXSRFToken;
var onCanceled;

@@ -121,3 +123,3 @@ function done() {

// onerror should only fire if it's a network error
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request));
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));

@@ -150,8 +152,9 @@ // Clean up request

// Add xsrf header
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
cookies.read(config.xsrfCookieName) :
undefined;
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
// Add xsrf header
var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
if (xsrfValue) {
requestHeaders[config.xsrfHeaderName] = xsrfValue;
}
}

@@ -200,3 +203,3 @@ }

}
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
reject(!cancel || cancel.type ? new CanceledError(null, config, req) : cancel);
request.abort();

@@ -212,3 +215,4 @@ request = null;

if (!requestData) {
// false, 0 (zero number), and '' (empty string) are valid JSON values
if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
requestData = null;

@@ -219,3 +223,3 @@ }

if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
if (protocol && platform.protocols.indexOf(protocol) === -1) {
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));

@@ -222,0 +226,0 @@ return;

@@ -8,3 +8,3 @@ 'use strict';

var defaults = require('./defaults');
var formDataToJSON = require('./helpers/formDataToJSON');
/**

@@ -62,2 +62,6 @@ * Create an instance of Axios

axios.formToJSON = function(thing) {
return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
};
module.exports = axios;

@@ -64,0 +68,0 @@

@@ -11,6 +11,8 @@ 'use strict';

* @param {string=} message The message.
* @param {Object=} config The config.
* @param {Object=} request The request.
*/
function CanceledError(message) {
function CanceledError(message, config, request) {
// eslint-disable-next-line no-eq-null,eqeqeq
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED);
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
this.name = 'CanceledError';

@@ -17,0 +19,0 @@ }

@@ -28,6 +28,5 @@ 'use strict';

var i;
var l = token._listeners.length;
var i = token._listeners.length;
for (i = 0; i < l; i++) {
while (i-- > 0) {
token._listeners[i](cancel);

@@ -54,3 +53,3 @@ }

executor(function cancel(message) {
executor(function cancel(message, config, request) {
if (token.reason) {

@@ -61,3 +60,3 @@ // Cancellation has already been requested

token.reason = new CanceledError(message);
token.reason = new CanceledError(message, config, request);
resolvePromise(token.reason);

@@ -64,0 +63,0 @@ });

@@ -28,3 +28,4 @@ 'use strict';

*
* @param {Object} config The config specific for this request (merged with this.defaults)
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
* @param {?Object} config
*/

@@ -62,2 +63,6 @@ Axios.prototype.request = function request(configOrUrl, config) {

var paramsSerializer = config.paramsSerializer;
utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
// filter out skipped interceptors

@@ -64,0 +69,0 @@ var requestInterceptorChain = [];

@@ -17,2 +17,9 @@ 'use strict';

Error.call(this);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack;
}
this.message = message;

@@ -61,3 +68,5 @@ this.name = 'AxiosError';

'ERR_BAD_REQUEST',
'ERR_CANCELED'
'ERR_CANCELED',
'ERR_NOT_SUPPORT',
'ERR_INVALID_URL'
// eslint-disable-next-line func-names

@@ -81,2 +90,4 @@ ].forEach(function(code) {

axiosError.cause = error;
axiosError.name = error.name;

@@ -83,0 +94,0 @@

@@ -8,2 +8,3 @@ 'use strict';

var CanceledError = require('../cancel/CanceledError');
var normalizeHeaderName = require('../helpers/normalizeHeaderName');

@@ -40,5 +41,9 @@ /**

config.headers,
null,
config.transformRequest
);
normalizeHeaderName(config.headers, 'Accept');
normalizeHeaderName(config.headers, 'Content-Type');
// Flatten headers

@@ -68,2 +73,3 @@ config.headers = utils.merge(

response.headers,
response.status,
config.transformResponse

@@ -83,2 +89,3 @@ );

reason.response.headers,
reason.response.status,
config.transformResponse

@@ -85,0 +92,0 @@ );

@@ -39,2 +39,11 @@ 'use strict';

/**
* Clear all interceptors from the stack
*/
InterceptorManager.prototype.clear = function clear() {
if (this.handlers) {
this.handlers = [];
}
};
/**
* Iterate over all the registered interceptors

@@ -41,0 +50,0 @@ *

@@ -21,2 +21,4 @@ 'use strict';

return utils.merge(target, source);
} else if (utils.isEmptyObject(source)) {
return utils.merge({}, target);
} else if (utils.isPlainObject(source)) {

@@ -75,2 +77,3 @@ return utils.merge({}, source);

'withCredentials': defaultToConfig2,
'withXSRFToken': defaultToConfig2,
'adapter': defaultToConfig2,

@@ -77,0 +80,0 @@ 'responseType': defaultToConfig2,

@@ -11,10 +11,11 @@ 'use strict';

* @param {Array} headers The headers for the request or response
* @param {Number} status HTTP status code
* @param {Array|Function} fns A single function or Array of functions
* @returns {*} The resulting transformed data
*/
module.exports = function transformData(data, headers, fns) {
module.exports = function transformData(data, headers, status, fns) {
var context = this || defaults;
/*eslint no-param-reassign:0*/
utils.forEach(fns, function transform(fn) {
data = fn.call(context, data, headers);
data = fn.call(context, data, headers, status);
});

@@ -21,0 +22,0 @@

@@ -8,2 +8,5 @@ 'use strict';

var toFormData = require('../helpers/toFormData');
var toURLEncodedForm = require('../helpers/toURLEncodedForm');
var platform = require('../platform');
var formDataToJSON = require('../helpers/formDataToJSON');

@@ -57,4 +60,17 @@ var DEFAULT_CONTENT_TYPE = {

if (utils.isFormData(data) ||
utils.isArrayBuffer(data) ||
var contentType = headers && headers['Content-Type'] || '';
var hasJSONContentType = contentType.indexOf('application/json') > -1;
var isObjectPayload = utils.isObject(data);
if (isObjectPayload && utils.isHTMLForm(data)) {
data = new FormData(data);
}
var isFormData = utils.isFormData(data);
if (isFormData) {
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
if (utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||

@@ -75,11 +91,21 @@ utils.isStream(data) ||

var isObjectPayload = utils.isObject(data);
var contentType = headers && headers['Content-Type'];
var isFileList;
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
var _FormData = this.env && this.env.FormData;
return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
} else if (isObjectPayload || contentType === 'application/json') {
if (isObjectPayload) {
if (contentType.indexOf('application/x-www-form-urlencoded') !== -1) {
return toURLEncodedForm(data, this.formSerializer).toString();
}
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
var _FormData = this.env && this.env.FormData;
return toFormData(
isFileList ? {'files[]': data} : data,
_FormData && new _FormData(),
this.formSerializer
);
}
}
if (isObjectPayload || hasJSONContentType ) {
setContentTypeIfUnset(headers, 'application/json');

@@ -94,7 +120,9 @@ return stringifySafely(data);

var transitional = this.transitional || defaults.transitional;
var silentJSONParsing = transitional && transitional.silentJSONParsing;
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
var JSONRequested = this.responseType === 'json';
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
var silentJSONParsing = transitional && transitional.silentJSONParsing;
var strictJSONParsing = !silentJSONParsing && JSONRequested;
try {

@@ -128,3 +156,4 @@ return JSON.parse(data);

env: {
FormData: require('./env/FormData')
FormData: platform.classes.FormData,
Blob: platform.classes.Blob
},

@@ -131,0 +160,0 @@

module.exports = {
"version": "0.27.2"
"version": "0.28.0"
};

@@ -5,8 +5,4 @@ 'use strict';

return function wrap() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
return fn.apply(thisArg, args);
return fn.apply(thisArg, arguments);
};
};
'use strict';
var utils = require('./../utils');
var utils = require('../utils');
var AxiosURLSearchParams = require('../helpers/AxiosURLSearchParams');

@@ -20,5 +21,6 @@ function encode(val) {

* @param {object} [params] The params to be appended
* @param {?object} options
* @returns {string} The formatted url
*/
module.exports = function buildURL(url, params, paramsSerializer) {
module.exports = function buildURL(url, params, options) {
/*eslint no-param-reassign:0*/

@@ -29,44 +31,19 @@ if (!params) {

var serializedParams;
if (paramsSerializer) {
serializedParams = paramsSerializer(params);
} else if (utils.isURLSearchParams(params)) {
serializedParams = params.toString();
} else {
var parts = [];
var hashmarkIndex = url.indexOf('#');
utils.forEach(params, function serialize(val, key) {
if (val === null || typeof val === 'undefined') {
return;
}
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
if (utils.isArray(val)) {
key = key + '[]';
} else {
val = [val];
}
var _encode = options && options.encode || encode;
utils.forEach(val, function parseValue(v) {
if (utils.isDate(v)) {
v = v.toISOString();
} else if (utils.isObject(v)) {
v = JSON.stringify(v);
}
parts.push(encode(key) + '=' + encode(v));
});
});
var serializerParams = utils.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
serializedParams = parts.join('&');
if (serializerParams) {
url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
}
if (serializedParams) {
var hashmarkIndex = url.indexOf('#');
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
};

@@ -16,7 +16,7 @@ 'use strict';

/**
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {

@@ -26,3 +26,3 @@ var href = url;

if (msie) {
// IE needs attribute set twice to normalize properties
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);

@@ -52,7 +52,7 @@ href = urlParsingNode.href;

/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {

@@ -65,3 +65,3 @@ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;

// Non standard browser envs (web workers, react-native) lack needed support.
// Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {

@@ -68,0 +68,0 @@ return function isURLSameOrigin() {

@@ -37,4 +37,4 @@ 'use strict';

i = line.indexOf(':');
key = utils.trim(line.substr(0, i)).toLowerCase();
val = utils.trim(line.substr(i + 1));
key = utils.trim(line.slice(0, i)).toLowerCase();
val = utils.trim(line.slice(i + 1));

@@ -41,0 +41,0 @@ if (key) {

'use strict';
var utils = require('../utils');
var AxiosError = require('../core/AxiosError');
var envFormData = require('../env/classes/FormData');
function isVisitable(thing) {
return utils.isPlainObject(thing) || utils.isArray(thing);
}
function removeBrackets(key) {
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
}
function renderKey(path, key, dots) {
if (!path) return key;
return path.concat(key).map(function each(token, i) {
// eslint-disable-next-line no-param-reassign
token = removeBrackets(token);
return !dots && i ? '[' + token + ']' : token;
}).join(dots ? '.' : '');
}
function isFlatArray(arr) {
return utils.isArray(arr) && !arr.some(isVisitable);
}
var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
function isSpecCompliant(thing) {
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
}
/**

@@ -9,11 +40,40 @@ * Convert a data object to FormData

* @param {?Object} [formData]
* @param {?Object} [options]
* @param {Function} [options.visitor]
* @param {Boolean} [options.metaTokens = true]
* @param {Boolean} [options.dots = false]
* @param {?Boolean} [options.indexes = false]
* @returns {Object}
**/
function toFormData(obj, formData) {
function toFormData(obj, formData, options) {
if (!utils.isObject(obj)) {
throw new TypeError('target must be an object');
}
// eslint-disable-next-line no-param-reassign
formData = formData || new FormData();
formData = formData || new (envFormData || FormData)();
var stack = [];
// eslint-disable-next-line no-param-reassign
options = utils.toFlatObject(options, {
metaTokens: true,
dots: false,
indexes: false
}, false, function defined(option, source) {
// eslint-disable-next-line no-eq-null,eqeqeq
return !utils.isUndefined(source[option]);
});
var metaTokens = options.metaTokens;
// eslint-disable-next-line no-use-before-define
var visitor = options.visitor || defaultVisitor;
var dots = options.dots;
var indexes = options.indexes;
var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
var useBlob = _Blob && isSpecCompliant(formData);
if (!utils.isFunction(visitor)) {
throw new TypeError('visitor must be a function');
}
function convertValue(value) {

@@ -26,4 +86,8 @@ if (value === null) return '';

if (!useBlob && utils.isBlob(value)) {
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
}
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
}

@@ -34,37 +98,80 @@

function build(data, parentKey) {
if (utils.isPlainObject(data) || utils.isArray(data)) {
if (stack.indexOf(data) !== -1) {
throw Error('Circular reference detected in ' + parentKey);
/**
*
* @param {*} value
* @param {String|Number} key
* @param {Array<String|Number>} path
* @this {FormData}
* @returns {boolean} return true to visit the each prop of the value recursively
*/
function defaultVisitor(value, key, path) {
var arr = value;
if (value && !path && typeof value === 'object') {
if (utils.endsWith(key, '{}')) {
// eslint-disable-next-line no-param-reassign
key = metaTokens ? key : key.slice(0, -2);
// eslint-disable-next-line no-param-reassign
value = JSON.stringify(value);
} else if (
(utils.isArray(value) && isFlatArray(value)) ||
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
)) {
// eslint-disable-next-line no-param-reassign
key = removeBrackets(key);
arr.forEach(function each(el, index) {
!utils.isUndefined(el) && formData.append(
// eslint-disable-next-line no-nested-ternary
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
convertValue(el)
);
});
return false;
}
}
stack.push(data);
if (isVisitable(value)) {
return true;
}
utils.forEach(data, function each(value, key) {
if (utils.isUndefined(value)) return;
var fullKey = parentKey ? parentKey + '.' + key : key;
var arr;
formData.append(renderKey(path, key, dots), convertValue(value));
if (value && !parentKey && typeof value === 'object') {
if (utils.endsWith(key, '{}')) {
// eslint-disable-next-line no-param-reassign
value = JSON.stringify(value);
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
// eslint-disable-next-line func-names
arr.forEach(function(el) {
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
});
return;
}
}
return false;
}
build(value, fullKey);
});
var stack = [];
stack.pop();
} else {
formData.append(parentKey, convertValue(data));
var exposedHelpers = Object.assign(predicates, {
defaultVisitor: defaultVisitor,
convertValue: convertValue,
isVisitable: isVisitable
});
function build(value, path) {
if (utils.isUndefined(value)) return;
if (stack.indexOf(value) !== -1) {
throw Error('Circular reference detected in ' + path.join('.'));
}
stack.push(value);
utils.forEach(value, function each(el, key) {
var result = !utils.isUndefined(el) && visitor.call(
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
);
if (result === true) {
build(el, path ? path.concat(key) : [key]);
}
});
stack.pop();
}
if (!utils.isObject(obj)) {
throw new TypeError('data must be an object');
}
build(obj);

@@ -71,0 +178,0 @@

@@ -128,2 +128,12 @@ 'use strict';

/**
* Determine if a value is a empty Object
*
* @param {Object} val The value to test
* @return {boolean} True if value is a empty Object, otherwise false
*/
function isEmptyObject(val) {
return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
}
/**
* Determine if a value is a Date

@@ -214,3 +224,3 @@ *

function trim(str) {
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
}

@@ -234,11 +244,12 @@

function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
navigator.product === 'NativeScript' ||
navigator.product === 'NS')) {
var product;
if (typeof navigator !== 'undefined' && (
(product = navigator.product) === 'ReactNative' ||
product === 'NativeScript' ||
product === 'NS')
) {
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined'
);
return typeof window !== 'undefined' && typeof document !== 'undefined';
}

@@ -372,7 +383,8 @@

* @param {Object} [destObj]
* @param {Function} [filter]
* @param {Function|Boolean} [filter]
* @param {Function} [propFilter]
* @returns {Object}
*/
function toFlatObject(sourceObj, destObj, filter) {
function toFlatObject(sourceObj, destObj, filter, propFilter) {
var props;

@@ -384,2 +396,4 @@ var i;

destObj = destObj || {};
// eslint-disable-next-line no-eq-null,eqeqeq
if (sourceObj == null) return destObj;

@@ -391,3 +405,3 @@ do {

prop = props[i];
if (!merged[prop]) {
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
destObj[prop] = sourceObj[prop];

@@ -397,3 +411,3 @@ merged[prop] = true;

}
sourceObj = Object.getPrototypeOf(sourceObj);
sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);

@@ -423,10 +437,11 @@

/**
* Returns new array from array like object
* Returns new array from array like object or null if failed
* @param {*} [thing]
* @returns {Array}
* @returns {?Array}
*/
function toArray(thing) {
if (!thing) return null;
if (isArray(thing)) return thing;
var i = thing.length;
if (isUndefined(i)) return null;
if (!isNumber(i)) return null;
var arr = new Array(i);

@@ -447,2 +462,34 @@ while (i-- > 0) {

function forEachEntry(obj, fn) {
var generator = obj && obj[Symbol.iterator];
var iterator = generator.call(obj);
var result;
while ((result = iterator.next()) && !result.done) {
var pair = result.value;
fn.call(obj, pair[0], pair[1]);
}
}
function matchAll(regExp, str) {
var matches;
var arr = [];
while ((matches = regExp.exec(str)) !== null) {
arr.push(matches);
}
return arr;
}
var isHTMLForm = kindOfTest('HTMLFormElement');
var hasOwnProperty = (function resolver(_hasOwnProperty) {
return function(obj, prop) {
return _hasOwnProperty.call(obj, prop);
};
})(Object.prototype.hasOwnProperty);
module.exports = {

@@ -458,2 +505,3 @@ isArray: isArray,

isPlainObject: isPlainObject,
isEmptyObject: isEmptyObject,
isUndefined: isUndefined,

@@ -479,3 +527,7 @@ isDate: isDate,

isTypedArray: isTypedArray,
isFileList: isFileList
isFileList: isFileList,
forEachEntry: forEachEntry,
matchAll: matchAll,
isHTMLForm: isHTMLForm,
hasOwnProperty: hasOwnProperty
};
{
"name": "axios",
"version": "0.27.2",
"version": "0.28.0",
"description": "Promise based HTTP client for the browser and node.js",

@@ -8,6 +8,6 @@ "main": "index.js",

"scripts": {
"test": "grunt test && dtslint",
"test": "node bin/ssl_hotfix.js grunt test && node bin/ssl_hotfix.js dtslint --localTs node_modules/typescript/lib",
"start": "node ./sandbox/server.js",
"preversion": "grunt version && npm test",
"build": "NODE_ENV=production grunt build",
"build": "cross-env NODE_ENV=production grunt build",
"examples": "node ./examples/server.js",

@@ -35,6 +35,14 @@ "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",

"devDependencies": {
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"abortcontroller-polyfill": "^1.7.3",
"body-parser": "^1.20.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"dtslint": "^4.2.1",
"es6-promise": "^4.2.8",
"express": "^4.18.1",
"formidable": "^2.0.1",

@@ -49,2 +57,3 @@ "grunt": "^1.4.1",

"grunt-mocha-test": "^0.13.3",
"grunt-shell": "^3.0.1",
"grunt-webpack": "^5.0.0",

@@ -66,2 +75,5 @@ "istanbul-instrumenter-loader": "^3.0.1",

"mocha": "^8.2.1",
"multer": "^1.4.4",
"rollup": "^2.67.0",
"rollup-plugin-terser": "^7.0.2",
"sinon": "^4.5.0",

@@ -76,3 +88,3 @@ "terser-webpack-plugin": "^4.2.3",

"./lib/adapters/http.js": "./lib/adapters/xhr.js",
"./lib/defaults/env/FormData.js": "./lib/helpers/null.js"
"./lib/platform/node/index.js": "./lib/platform/browser/index.js"
},

@@ -83,4 +95,5 @@ "jsdelivr": "dist/axios.min.js",

"dependencies": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
},

@@ -87,0 +100,0 @@ "bundlesize": [

@@ -6,9 +6,10 @@ # axios

![Build status](https://github.com/axios/axios/actions/workflows/ci.yml/badge.svg)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/axios/axios)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/axios/axios)
[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios)
[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
[![Known Vulnerabilities](https://snyk.io/test/npm/axios/badge.svg)](https://snyk.io/test/npm/axios)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios)

@@ -43,8 +44,10 @@ Promise based HTTP client for the browser and node.js

- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
- [Browser](#browser)
- [Node.js](#nodejs)
- [Query string](#query-string)
- [Form data](#form-data)
- [Automatic serialization](#-automatic-serialization)
- [Manual FormData passing](#manual-formdata-passing)
- [URLSearchParams](#urlsearchparams)
- [Query string](#query-string-older-browsers)
- [🆕 Automatic serialization](#-automatic-serialization-to-urlsearchparams)
- [Using multipart/form-data format](#using-multipartform-data-format)
- [FormData](#formdata)
- [🆕 Automatic serialization](#-automatic-serialization-to-formdata)
- [Files Posting](#files-posting)
- [HTML Form Posting](#html-form-posting-browser)
- [Semver](#semver)

@@ -60,3 +63,3 @@ - [Promises](#promises)

- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
- Make [http](http://nodejs.org/api/http.html) requests from node.js
- Make [http](https://nodejs.org/api/http.html) requests from node.js
- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API

@@ -67,7 +70,8 @@ - Intercept request and response

- Automatic transforms for JSON data
- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
- 🆕 Automatic data object serialization to `multipart/form-data` and `x-www-form-urlencoded` body encodings
- Client side support for protecting against [XSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery)
## Browser Support
![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
--- | --- | --- | --- | --- | --- |

@@ -98,2 +102,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |

Using pnpm:
```bash
$ pnpm add axios
```
Using jsDelivr CDN:

@@ -155,3 +165,3 @@

// always executed
});
});

@@ -227,3 +237,3 @@ // Want to use async/await? Add the `async` keyword to your outer function/method.

method: 'get',
url: 'http://bit.ly/2mTM3nY',
url: 'https://bit.ly/2mTM3nY',
responseType: 'stream'

@@ -340,6 +350,5 @@ })

// `paramsSerializer` is an optional function in charge of serializing `params`
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
paramsSerializer: function (params) {
return Qs.stringify(params, {arrayFormat: 'brackets'})
// `paramsSerializer` is an optional config in charge of serializing `params`
paramsSerializer: {
indexes: null // array indexes format (null - no brackets, false - empty brackets, true - brackets with indexes)
},

@@ -356,3 +365,3 @@

},
// syntax alternative to send data into the body

@@ -402,2 +411,5 @@ // method post

// `undefined` (default) - set XSRF header only for the same origin requests
withXSRFToken: boolean | undefined | ((config: AxiosRequestConfig) => boolean | undefined),
// `onUploadProgress` allows handling of progress events for uploads

@@ -442,3 +454,3 @@ // browser only

}
};
},

@@ -467,3 +479,3 @@ // `socketPath` defines a UNIX Socket to be used in node.js.

// `Proxy-Authorization` custom headers you have set using `headers`.
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
proxy: {

@@ -487,4 +499,4 @@ protocol: 'https',

// `decompress` indicates whether or not the response body should be decompressed
// automatically. If set to `true` will also remove the 'content-encoding' header
// `decompress` indicates whether or not the response body should be decompressed
// automatically. If set to `true` will also remove the 'content-encoding' header
// from the responses objects of all decompressed responses

@@ -511,3 +523,3 @@ // - Node only (XHR cannot turn off decompression)

forcedJSONParsing: true,
// throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts

@@ -520,2 +532,9 @@ clarifyTimeoutError: false,

FormData: window?.FormData || global?.FormData
},
formSerializer: {
visitor: (value, key, path, helpers)=> {}; // custom visitor function to serialize form values
dots: boolean; // use dots instead of brackets format
metaTokens: boolean; // keep special endings like {} in parameter key
indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
}

@@ -541,3 +560,3 @@ }

// `headers` the HTTP headers that the server responded with
// All header names are lower cased and can be accessed using the bracket notation.
// All header names are lowercase and can be accessed using the bracket notation.
// Example: `response.headers['content-type']`

@@ -601,3 +620,3 @@ headers: {},

Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults/index.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.

@@ -652,2 +671,11 @@ ```js

You can also clear all interceptors for requests or responses.
```js
const instance = axios.create();
instance.interceptors.request.use(function () {/*...*/});
instance.interceptors.request.clear(); // Removes interceptors from requests
instance.interceptors.response.use(function () {/*...*/});
instance.interceptors.response.clear(); // Removes interceptors from responses
```
You can add interceptors to a custom instance of axios.

@@ -661,3 +689,3 @@

When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag

@@ -673,3 +701,3 @@ to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.

If you want to execute a particular interceptor based on a runtime check,
If you want to execute a particular interceptor based on a runtime check,
you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return

@@ -697,3 +725,3 @@ of `runWhen` is `false`. The function will be called with the config

- then only the last interceptor's result is returned
- then every interceptor receives the result of it's predecessor
- then every interceptor receives the result of its predecessor
- and when the fulfillment-interceptor throws

@@ -703,3 +731,3 @@ - then the following fulfillment-interceptor is not called

- once caught, another following fulfill-interceptor is called again (just like in a promise chain).
Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code.

@@ -820,23 +848,22 @@

> Note: you can cancel several requests with the same cancel token/abort controller.
> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make real request.
> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make a real request.
> During the transition period, you can use both cancellation APIs, even for the same request:
## Using application/x-www-form-urlencoded format
## Using `application/x-www-form-urlencoded` format
By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
### URLSearchParams
### Browser
By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers, [and Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
```js
const params = new URLSearchParams();
params.append('param1', 'value1');
params.append('param2', 'value2');
const params = new URLSearchParams({ foo: 'bar' });
params.append('extraparam', 'value');
axios.post('/foo', params);
```
> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
### Query string (Older browsers)
For compatibility with very old browsers, there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:

@@ -863,31 +890,95 @@

### Node.js
### Older Node.js versions
#### Query string
For older Node.js engines, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
```js
const querystring = require('querystring');
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
axios.post('https://something.com/', querystring.stringify({ foo: 'bar' }));
```
or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:
You can also use the [`qs`](https://github.com/ljharb/qs) library.
> NOTE:
> The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case.
### 🆕 Automatic serialization to URLSearchParams
Axios will automatically serialize the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded".
```
const data = {
x: 1,
arr: [1, 2, 3],
arr2: [1, [2], 3],
users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}],
};
await axios.postForm('https://postman-echo.com/post', data,
{headers: {'content-type': 'application/x-www-form-urlencoded'}}
);
```
The server will handle it as
```js
const url = require('url');
const params = new url.URLSearchParams({ foo: 'bar' });
axios.post('http://something.com/', params.toString());
{
x: '1',
'arr[]': [ '1', '2', '3' ],
'arr2[0]': '1',
'arr2[1][0]': '2',
'arr2[2]': '3',
'arr3[]': [ '1', '2', '3' ],
'users[0][name]': 'Peter',
'users[0][surname]': 'griffin',
'users[1][name]': 'Thomas',
'users[1][surname]': 'Anderson'
}
````
If your backend body-parser (like `body-parser` of `express.js`) supports nested objects decoding, you will get the same object on the server-side automatically
```js
var app = express();
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
app.post('/', function (req, res, next) {
// echo body as JSON
res.send(JSON.stringify(req.body));
});
server = app.listen(3000);
```
You can also use the [`qs`](https://github.com/ljharb/qs) library.
## Using `multipart/form-data` format
> NOTE:
> The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case.
### FormData
#### Form data
To send the data as a `multipart/formdata` you need to pass a formData instance as a payload.
Setting the `Content-Type` header is not required as Axios guesses it based on the payload type.
##### 🆕 Automatic serialization
```js
const formData = new FormData();
formData.append('foo', 'bar');
Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type`
axios.post('https://httpbin.org/post', formData);
```
In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
```js
const FormData = require('form-data');
const form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
axios.post('https://example.com', form)
```
### 🆕 Automatic serialization to FormData
Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type`
header is set to `multipart/form-data`.

@@ -926,43 +1017,143 @@

- `{}` - serialize the value with JSON.stringify
- `[]` - unwrap the array like object as separate fields with the same key
- `[]` - unwrap the array-like object as separate fields with the same key
> NOTE:
> unwrap/expand operation will be used by default on arrays and FileList objects
FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases:
- `visitor: Function` - user-defined visitor function that will be called recursively to serialize the data object
to a `FormData` object by following custom rules.
- `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects;
- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON.
- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects
- `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
- `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
- `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`)
Let's say we have an object like this one:
```js
const axios= require('axios');
const obj = {
x: 1,
arr: [1, 2, 3],
arr2: [1, [2], 3],
users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}],
'obj2{}': [{x:1}]
};
```
axios.post('https://httpbin.org/post', {
'myObj{}': {x: 1, s: "foo"},
'files[]': document.querySelector('#fileInput').files
}, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(({data})=> console.log(data));
The following steps will be executed by the Axios serializer internally:
```js
const formData= new FormData();
formData.append('x', '1');
formData.append('arr[]', '1');
formData.append('arr[]', '2');
formData.append('arr[]', '3');
formData.append('arr2[0]', '1');
formData.append('arr2[1][0]', '2');
formData.append('arr2[2]', '3');
formData.append('users[0][name]', 'Peter');
formData.append('users[0][surname]', 'Griffin');
formData.append('users[1][name]', 'Thomas');
formData.append('users[1][surname]', 'Anderson');
formData.append('obj2{}', '[{"x":1}]');
```
Axios supports the following shortcut methods: `postForm`, `putForm`, `patchForm`
which are just the corresponding http methods with a header preset: `Content-Type`: `multipart/form-data`.
which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`.
FileList object can be passed directly:
## Files Posting
You can easily sumbit a single file
```js
await axios.postForm('https://httpbin.org/post', {
'myVar' : 'foo',
'file': document.querySelector('#fileInput').files[0]
});
```
or multiple files as `multipart/form-data`.
```js
await axios.postForm('https://httpbin.org/post', {
'files[]': document.querySelector('#fileInput').files
});
```
`FileList` object can be passed directly:
```js
await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files)
```
All files will be sent with the same field names: `files[]`;
All files will be sent with the same field names: `files[]`.
##### Manual FormData passing
In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
## 🆕 HTML Form Posting (browser)
Pass HTML Form element as a payload to submit it as `multipart/form-data` content.
```js
const FormData = require('form-data');
const form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm'));
```
axios.post('https://example.com', form)
`FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`:
```js
await axios.post('https://httpbin.org/post', document.querySelector('#htmlForm'), {
headers: {
'Content-Type': 'application/json'
}
})
```
For example, the Form
```html
<form id="form">
<input type="text" name="foo" value="1">
<input type="text" name="deep.prop" value="2">
<input type="text" name="deep prop spaced" value="3">
<input type="text" name="baz" value="4">
<input type="text" name="baz" value="5">
<select name="user.age">
<option value="value1">Value 1</option>
<option value="value2" selected>Value 2</option>
<option value="value3">Value 3</option>
</select>
<input type="submit" value="Save">
</form>
```
will be submitted as the following JSON object:
```js
{
"foo": "1",
"deep": {
"prop": {
"spaced": "3"
}
},
"baz": [
"4",
"5"
],
"user": {
"age": "value2"
}
}
````
Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
## Semver

@@ -974,3 +1165,3 @@

axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises).
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).

@@ -980,3 +1171,3 @@

axios includes [TypeScript](http://typescriptlang.org) definitions and a type guard for axios errors.
axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors.

@@ -999,3 +1190,3 @@ ```typescript

You can use Gitpod an online IDE(which is free for Open Source) for contributing or running the examples online.
You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online.

@@ -1002,0 +1193,0 @@ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/master/examples/server.js)

@@ -1,5 +0,5 @@

# Security Policy
# Reporting a Vulnerability
## Reporting a Vulnerability
If you discover a security vulnerability within axios, please submit a report via [huntr.dev](https://huntr.dev/bounties/?target=https%3A%2F%2Fgithub.com%2Faxios%2Faxios). Bounties and CVEs are automatically managed and allocated via the platform.
Please report security issues to jasonsaayman@gmail.com
All security vulnerabilities will be promptly addressed.
# Upgrade Guide
### 0.18.x -> 0.19.0
## 0.18.x -> 0.19.0
#### HTTPS Proxies
### HTTPS Proxies
Routing through an https proxy now requires setting the `protocol` attribute of the proxy configuration to `https`
### 0.15.x -> 0.16.0
## 0.15.x -> 0.16.0
#### `Promise` Type Declarations
### `Promise` Type Declarations
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
### 0.13.x -> 0.14.0
## 0.13.x -> 0.14.0
#### TypeScript Definitions
### TypeScript Definitions

@@ -31,3 +31,3 @@ The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.

#### `agent` Config Option
### `agent` Config Option

@@ -45,3 +45,3 @@ The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.

#### `progress` Config Option
### `progress` Config Option

@@ -64,7 +64,7 @@ The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.

### 0.12.x -> 0.13.0
## 0.12.x -> 0.13.0
The `0.13.0` release contains several changes to custom adapters and error handling.
#### Error Handling
### Error Handling

@@ -83,3 +83,3 @@ Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.

#### Request Adapters
### Request Adapters

@@ -128,10 +128,11 @@ This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.

See the related commits for more details:
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
### 0.5.x -> 0.6.0
## 0.5.x -> 0.6.0
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
#### ES6 Promise Polyfill
### ES6 Promise Polyfill

@@ -147,3 +148,3 @@ Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.

#### `axios.success`/`axios.error`
### `axios.success`/`axios.error`

@@ -162,3 +163,3 @@ The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.

#### UMD
### UMD

@@ -165,0 +166,0 @@ Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc