summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-20 13:31:06 +0200
committerFlorian Dold <florian@dold.me>2021-08-20 13:31:06 +0200
commit3fb2c7a5cd0adb550308fe7db9db69453afd0515 (patch)
treeb83ceffb2f45f86585f3899d0407bc1633256002
downloadnode-vendor-3fb2c7a5cd0adb550308fe7db9db69453afd0515.tar.gz
node-vendor-3fb2c7a5cd0adb550308fe7db9db69453afd0515.tar.bz2
node-vendor-3fb2c7a5cd0adb550308fe7db9db69453afd0515.zip
Squashed 'axios/' content from commit a64050a
git-subtree-dir: axios git-subtree-split: a64050a6cfbcc708a55a7dc8030d85b1c78cdf38
-rw-r--r--.eslintrc.js148
-rw-r--r--.github/ISSUE_TEMPLATE.md31
-rw-r--r--.github/ISSUE_TEMPLATE/---bug-report.md46
-rw-r--r--.github/ISSUE_TEMPLATE/---documentation.md26
-rw-r--r--.github/ISSUE_TEMPLATE/---feature-request.md33
-rw-r--r--.github/ISSUE_TEMPLATE/---support-or-usage-question.md46
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md13
-rw-r--r--.github/workflows/close-issues.yml17
-rw-r--r--.github/workflows/stale.yml31
-rw-r--r--.gitignore10
-rw-r--r--.npmignore18
-rw-r--r--.travis.yml16
-rw-r--r--CHANGELOG.md685
-rw-r--r--CODE_OF_CONDUCT.md74
-rw-r--r--COLLABORATOR_GUIDE.md23
-rw-r--r--CONTRIBUTING.md66
-rw-r--r--COOKBOOK.md126
-rw-r--r--ECOSYSTEM.md40
-rw-r--r--Gruntfile.js107
-rw-r--r--LICENSE19
-rwxr-xr-xREADME.md800
-rw-r--r--UPGRADE_GUIDE.md162
-rw-r--r--bower.json38
-rw-r--r--dist/axios.js1756
-rw-r--r--dist/axios.map1
-rw-r--r--dist/axios.min.js3
-rw-r--r--dist/axios.min.map1
-rw-r--r--examples/README.md14
-rw-r--r--examples/all/index.html44
-rw-r--r--examples/amd/index.html37
-rw-r--r--examples/get/index.html33
-rw-r--r--examples/get/server.js34
-rw-r--r--examples/post/index.html40
-rw-r--r--examples/post/server.js16
-rw-r--r--examples/server.js140
-rw-r--r--examples/transform-response/index.html44
-rw-r--r--examples/upload/index.html48
-rw-r--r--examples/upload/server.js13
-rw-r--r--index.d.ts161
-rw-r--r--index.js1
-rw-r--r--karma.conf.js246
-rw-r--r--lib/adapters/README.md37
-rwxr-xr-xlib/adapters/http.js303
-rw-r--r--lib/adapters/xhr.js179
-rw-r--r--lib/axios.js56
-rw-r--r--lib/cancel/Cancel.js19
-rw-r--r--lib/cancel/CancelToken.js57
-rw-r--r--lib/cancel/isCancel.js5
-rw-r--r--lib/core/Axios.js95
-rw-r--r--lib/core/InterceptorManager.js52
-rw-r--r--lib/core/README.md7
-rw-r--r--lib/core/buildFullPath.js20
-rw-r--r--lib/core/createError.js18
-rw-r--r--lib/core/dispatchRequest.js79
-rw-r--r--lib/core/enhanceError.js42
-rw-r--r--lib/core/mergeConfig.js87
-rw-r--r--lib/core/settle.js25
-rw-r--r--lib/core/transformData.js20
-rw-r--r--lib/defaults.js98
-rw-r--r--lib/helpers/README.md7
-rw-r--r--lib/helpers/bind.js11
-rw-r--r--lib/helpers/buildURL.js70
-rw-r--r--lib/helpers/combineURLs.js14
-rw-r--r--lib/helpers/cookies.js53
-rw-r--r--lib/helpers/deprecatedMethod.js24
-rw-r--r--lib/helpers/isAbsoluteURL.js14
-rw-r--r--lib/helpers/isAxiosError.js11
-rw-r--r--lib/helpers/isURLSameOrigin.js68
-rw-r--r--lib/helpers/normalizeHeaderName.js12
-rw-r--r--lib/helpers/parseHeaders.js53
-rw-r--r--lib/helpers/spread.js27
-rw-r--r--lib/utils.js351
-rw-r--r--package.json86
-rw-r--r--sandbox/client.html173
-rw-r--r--sandbox/client.js20
-rw-r--r--sandbox/server.js80
-rw-r--r--test/manual/basic.html21
-rw-r--r--test/manual/cors.html20
-rw-r--r--test/manual/fixture.json3
-rw-r--r--test/manual/promise.js9
-rw-r--r--test/specs/__helpers.js123
-rw-r--r--test/specs/adapter.spec.js19
-rw-r--r--test/specs/api.spec.js68
-rw-r--r--test/specs/basicAuth.spec.js3
-rw-r--r--test/specs/cancel.spec.js89
-rw-r--r--test/specs/cancel/Cancel.spec.js15
-rw-r--r--test/specs/cancel/CancelToken.spec.js87
-rw-r--r--test/specs/cancel/isCancel.spec.js12
-rw-r--r--test/specs/core/buildFullPath.spec.js20
-rw-r--r--test/specs/core/createError.spec.js29
-rw-r--r--test/specs/core/enhanceError.spec.js21
-rw-r--r--test/specs/core/mergeConfig.spec.js310
-rw-r--r--test/specs/core/settle.spec.js85
-rw-r--r--test/specs/core/transformData.spec.js30
-rw-r--r--test/specs/defaults.spec.js162
-rw-r--r--test/specs/headers.spec.js115
-rw-r--r--test/specs/helpers/bind.spec.js12
-rw-r--r--test/specs/helpers/buildURL.spec.js75
-rw-r--r--test/specs/helpers/combineURLs.spec.js23
-rw-r--r--test/specs/helpers/cookies.spec.js36
-rw-r--r--test/specs/helpers/isAbsoluteURL.spec.js23
-rw-r--r--test/specs/helpers/isAxiosError.spec.js20
-rw-r--r--test/specs/helpers/isURLSameOrigin.spec.js11
-rw-r--r--test/specs/helpers/normalizeHeaderName.spec.js21
-rw-r--r--test/specs/helpers/parseHeaders.spec.js45
-rw-r--r--test/specs/helpers/spread.spec.js21
-rw-r--r--test/specs/instance.spec.js114
-rw-r--r--test/specs/interceptors.spec.js273
-rw-r--r--test/specs/options.spec.js112
-rw-r--r--test/specs/progress.spec.js111
-rw-r--r--test/specs/promise.spec.js70
-rw-r--r--test/specs/requests.spec.js439
-rw-r--r--test/specs/transform.spec.js94
-rw-r--r--test/specs/utils/extend.spec.js34
-rw-r--r--test/specs/utils/forEach.spec.js63
-rw-r--r--test/specs/utils/isX.spec.js80
-rw-r--r--test/specs/utils/merge.spec.js84
-rw-r--r--test/specs/utils/trim.spec.js12
-rw-r--r--test/specs/xsrf.spec.js82
-rw-r--r--test/typescript/axios.ts369
-rw-r--r--test/unit/adapters/cert.pem17
-rw-r--r--test/unit/adapters/http.js883
-rw-r--r--test/unit/adapters/key.pem27
-rw-r--r--test/unit/regression/SNYK-JS-AXIOS-1038255.js61
-rw-r--r--webpack.config.js44
125 files changed, 11977 insertions, 0 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000..7f9e73e
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,148 @@
+module.exports = {
+ "globals": {
+ "console": true,
+ "module": true,
+ "require": true
+ },
+ "env": {
+ "browser": true,
+ "node": true
+ },
+ "rules": {
+/**
+ * Strict mode
+ */
+ "strict": [2, "global"], // http://eslint.org/docs/rules/strict
+
+/**
+ * Variables
+ */
+ "no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
+ "no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
+ "no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars
+ "vars": "local",
+ "args": "after-used"
+ }],
+ "no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
+
+/**
+ * Possible errors
+ */
+ "comma-dangle": [2, "never"], // http://eslint.org/docs/rules/comma-dangle
+ "no-cond-assign": [2, "except-parens"], // http://eslint.org/docs/rules/no-cond-assign
+ "no-console": 1, // http://eslint.org/docs/rules/no-console
+ "no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
+ "no-alert": 1, // http://eslint.org/docs/rules/no-alert
+ "no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition
+ "no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys
+ "no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
+ "no-empty": 2, // http://eslint.org/docs/rules/no-empty
+ "no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
+ "no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
+ "no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
+ "no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
+ "no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
+ "no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp
+ "no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace
+ "no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls
+ "no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays
+ "no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable
+ "use-isnan": 2, // http://eslint.org/docs/rules/use-isnan
+ "block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var
+
+/**
+ * Best practices
+ */
+ "consistent-return": 2, // http://eslint.org/docs/rules/consistent-return
+ "curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly
+ "default-case": 2, // http://eslint.org/docs/rules/default-case
+ "dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation
+ "allowKeywords": true
+ }],
+ "eqeqeq": 2, // http://eslint.org/docs/rules/eqeqeq
+ "guard-for-in": 2, // http://eslint.org/docs/rules/guard-for-in
+ "no-caller": 2, // http://eslint.org/docs/rules/no-caller
+ "no-else-return": 2, // http://eslint.org/docs/rules/no-else-return
+ "no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null
+ "no-eval": 2, // http://eslint.org/docs/rules/no-eval
+ "no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native
+ "no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind
+ "no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough
+ "no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal
+ "no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval
+ "no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks
+ "no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func
+ "no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str
+ "no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign
+ "no-new": 2, // http://eslint.org/docs/rules/no-new
+ "no-new-func": 2, // http://eslint.org/docs/rules/no-new-func
+ "no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers
+ "no-octal": 2, // http://eslint.org/docs/rules/no-octal
+ "no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape
+ "no-param-reassign": 2, // http://eslint.org/docs/rules/no-param-reassign
+ "no-proto": 2, // http://eslint.org/docs/rules/no-proto
+ "no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
+ "no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
+ "no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
+ "no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
+ "no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
+ "no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
+ "no-with": 2, // http://eslint.org/docs/rules/no-with
+ "radix": 2, // http://eslint.org/docs/rules/radix
+ "vars-on-top": 0, // http://eslint.org/docs/rules/vars-on-top
+ "wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
+ "yoda": 2, // http://eslint.org/docs/rules/yoda
+
+/**
+ * Style
+ */
+ "indent": [2, 2], // http://eslint.org/docs/rules/indent
+ "brace-style": [2, // http://eslint.org/docs/rules/brace-style
+ "1tbs", {
+ "allowSingleLine": true
+ }],
+ "quotes": [
+ 2, "single", "avoid-escape" // http://eslint.org/docs/rules/quotes
+ ],
+ "camelcase": [2, { // http://eslint.org/docs/rules/camelcase
+ "properties": "never"
+ }],
+ "comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing
+ "before": false,
+ "after": true
+ }],
+ "comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style
+ "eol-last": 2, // http://eslint.org/docs/rules/eol-last
+ "func-names": 1, // http://eslint.org/docs/rules/func-names
+ "key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing
+ "beforeColon": false,
+ "afterColon": true
+ }],
+ "new-cap": [2, { // http://eslint.org/docs/rules/new-cap
+ "newIsCap": true
+ }],
+ "no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
+ "max": 2
+ }],
+ "no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
+ "no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
+ "no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
+ "no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
+ "no-extra-parens": [2, "functions"], // http://eslint.org/docs/rules/no-extra-parens
+ "no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle
+ "one-var": [2, "never"], // http://eslint.org/docs/rules/one-var
+ "padded-blocks": [2, "never"], // http://eslint.org/docs/rules/padded-blocks
+ "semi": [2, "always"], // http://eslint.org/docs/rules/semi
+ "semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing
+ "before": false,
+ "after": true
+ }],
+ "keyword-spacing": 2, // http://eslint.org/docs/rules/keyword-spacing
+ "space-before-blocks": 2, // http://eslint.org/docs/rules/space-before-blocks
+ "space-before-function-paren": [2, "never"], // http://eslint.org/docs/rules/space-before-function-paren
+ "space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
+ "spaced-comment": [2, "always", {// http://eslint.org/docs/rules/spaced-comment
+ "markers": ["global", "eslint"]
+ }]
+ }
+}
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..a82e473
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,31 @@
+<!-- Click "Preview" for a more readable version --
+
+Please read and follow the instructions before submitting an issue:
+
+- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
+- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
+- If you aren't sure that the issue is caused by axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
+- If you're reporting a bug, ensure it isn't already fixed in the latest axios version.
+- If you need a new feature there's a chance it's already implemented in a [library](https://github.com/axios/axios/blob/master/ECOSYSTEM.md) or you can implement it using [interceptors](https://github.com/axios/axios#interceptors).
+- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
+
+**⚠️👆 Delete the instructions before submitting the issue 👆⚠️**
+
+-->
+
+#### Summary
+
+Describe your issue here, including as much detail as necessary.
+
+If you're reporting a bug, include the relevant code and stack traces to debug it (removing any private information).
+
+If you're requesting a feature, include some context and examples of code using it.
+
+#### Environment
+ - Axios Version [e.g. 0.18.0]
+ - Adapter [e.g. XHR/HTTP]
+ - Browser [e.g. Chrome, Safari]
+ - Browser Version [e.g. 22]
+ - Node.js Version [e.g. 13.0.1]
+ - OS: [e.g. iOS 12.1.0, OSX 10.13.4]
+ - Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
diff --git a/.github/ISSUE_TEMPLATE/---bug-report.md b/.github/ISSUE_TEMPLATE/---bug-report.md
new file mode 100644
index 0000000..8af77a3
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/---bug-report.md
@@ -0,0 +1,46 @@
+---
+name: "\U0001F41E Bug Report"
+about: Report a reproducible bug
+title: ''
+labels: 'status:possible bug'
+assignees: ''
+
+---
+
+<!-- Click "Preview" for a more readable version --
+
+Please read and follow the instructions before submitting an issue:
+
+- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
+- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
+- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
+- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
+- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
+
+⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
+-->
+
+#### Describe the bug
+A clear and concise description of what the bug is. **If your problem is not a bug, please file under Support or Usage Question**
+
+#### To Reproduce
+Code snippet to reproduce, ideally that will work by pasting into something like https://npm.runkit.com/axios, a hosted solution, or a repository that illustrates the issue. **If your problem is not reproducible, please file under Support or Usage Question**
+
+```js
+// Example code here
+```
+
+#### Expected behavior
+A clear and concise description of what you expected to happen.
+
+#### Environment
+ - Axios Version [e.g. 0.18.0]
+ - Adapter [e.g. XHR/HTTP]
+ - Browser [e.g. Chrome, Safari]
+ - Browser Version [e.g. 22]
+ - Node.js Version [e.g. 13.0.1]
+ - OS: [e.g. iOS 12.1.0, OSX 10.13.4]
+ - Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
+
+#### Additional context/Screenshots
+Add any other context about the problem here. If applicable, add screenshots to help explain.
diff --git a/.github/ISSUE_TEMPLATE/---documentation.md b/.github/ISSUE_TEMPLATE/---documentation.md
new file mode 100644
index 0000000..66dcb03
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/---documentation.md
@@ -0,0 +1,26 @@
+---
+name: "\U0001F4DA Documentation"
+about: Report an error or area that needs clarification
+title: ''
+labels: 'type:documentation'
+assignees: ''
+
+---
+
+<!-- Click "Preview" for a more readable version --
+
+If you found an area that needs clarification, feel free to open a PR or list the section/content that could be improved below
+
+Don't remove any title of the issue template, or it will be treated as invalid by the bot.
+
+⚠️👆 Feel free to refer to these instructions before submitting the issue 👆⚠️
+-->
+
+#### Section/Content To Improve
+Quote or link to section
+
+#### Suggested Improvement
+Identify what is confusing or incorrect and what could make it better
+
+#### Relevant File(s)
+[e.g. README.md]
diff --git a/.github/ISSUE_TEMPLATE/---feature-request.md b/.github/ISSUE_TEMPLATE/---feature-request.md
new file mode 100644
index 0000000..fe56760
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/---feature-request.md
@@ -0,0 +1,33 @@
+---
+name: "✨ Feature Request"
+about: Suggest an idea or feature
+title: ''
+labels: 'type:feature'
+assignees: ''
+
+---
+
+<!-- Click "Preview" for a more readable version --
+
+Please read and follow the instructions before submitting an issue:
+
+- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
+- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
+- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
+- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
+- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
+
+⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
+-->
+
+#### Is your feature request related to a problem? Please describe.
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+#### Describe the solution you'd like
+A clear and concise description of what you want to happen.
+
+#### Describe alternatives you've considered
+A clear and concise description of any alternative solutions or features you've considered.
+
+#### Additional context
+Add any other context or screenshots about the feature request here.
diff --git a/.github/ISSUE_TEMPLATE/---support-or-usage-question.md b/.github/ISSUE_TEMPLATE/---support-or-usage-question.md
new file mode 100644
index 0000000..e73035f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/---support-or-usage-question.md
@@ -0,0 +1,46 @@
+---
+name: "\U0001F914 Support or Usage Question"
+about: Get help using Axios
+title: ''
+labels: 'type:question'
+assignees: ''
+
+---
+
+<!-- Click "Preview" for a more readable version --
+
+Please read and follow the instructions before submitting an issue:
+
+- Read all our documentation, especially the [README](https://github.com/axios/axios/blob/master/README.md). It may contain information that helps you solve your issue.
+- Ensure your issue isn't already [reported](https://github.com/axios/axios/issues?utf8=%E2%9C%93&q=is%3Aissue).
+- If you aren't sure that the issue is caused by Axios or you just need help, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/axios) or [our chat](https://gitter.im/mzabriskie/axios).
+- If you're reporting a bug, ensure it isn't already fixed in the latest Axios version.
+- Don't remove any title of the issue template, or it will be treated as invalid by the bot.
+
+⚠️👆 Feel free to these instructions before submitting the issue 👆⚠️
+-->
+
+#### Describe the issue
+A clear and concise description of what the issue is.
+
+#### Example Code
+Code snippet to illustrate your question
+
+```js
+// Example code here
+```
+
+#### Expected behavior, if applicable
+A clear and concise description of what you expected to happen.
+
+#### Environment
+ - Axios Version [e.g. 0.18.0]
+ - Adapter [e.g. XHR/HTTP]
+ - Browser [e.g. Chrome, Safari]
+ - Browser Version [e.g. 22]
+ - Node.js Version [e.g. 13.0.1]
+ - OS: [e.g. iOS 12.1.0, OSX 10.13.4]
+ - Additional Library Versions [e.g. React 16.7, React Native 0.58.0]
+
+#### Additional context/Screenshots
+Add any other context about the problem here. If applicable, add screenshots to help explain.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..092611e
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,13 @@
+<!-- Click "Preview" for a more readable version -->
+
+#### Instructions
+
+Please read and follow the instructions before creating and submitting a pull request:
+
+- Create an issue explaining the feature. It could save you some effort in case we don't consider it should be included in axios.
+- If you're fixing a bug, try to commit the failing test/s and the code fixing it in different commits.
+- Ensure you're following our [contributing guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md).
+
+**⚠️👆 Delete the instructions before submitting the pull request 👆⚠️**
+
+Describe your pull request here.
diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml
new file mode 100644
index 0000000..2127fe1
--- /dev/null
+++ b/.github/workflows/close-issues.yml
@@ -0,0 +1,17 @@
+name: 'Close Invalid Issues'
+
+on:
+ issues:
+ types: [opened]
+
+jobs:
+ auto_close_issues:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Automatically close issues that don't follow the issue template
+ uses: lucasbento/auto-close-issues@v1.0.2
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ issue-close-message: 'Hello! :wave: \n\nThis issue is being automatically closed because it does not follow the issue template. Please read the issue template carefully and follow all of the instructions when opening a new issue. \n\nThanks'
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..1ad2c3a
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,31 @@
+name: 'Close Stale'
+
+on:
+ schedule:
+ - cron: '0 0 * * 1'
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Close Stale Issues
+ uses: actions/stale@v3
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ stale-issue-message: |
+ Hello! :wave:
+
+ This issue is being automatically marked as stale because it has not been updated in a while. Please confirm that the issue is still present and reproducible. If no updates or new comments are received the issue will be closed in a few days.
+
+ Thanks.
+ stale-pr-message: |
+ Hello! :wave:
+
+ This pull request is being automatically marked as stale because it has not been updated in a while. Please confirm that the issue is still present and reproducible. If no updates or new comments are received the pull request will be closed in a few days.
+
+ Thanks.
+ stale-issue-label: 'status:stale'
+ stale-pr-label: 'status:stale'
+ only-labels: 'status:more info needed'
+ days-before-stale: 30
+ days-before-close: 14
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a003950
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.idea
+.tscache
+.DS_Store
+node_modules/
+typings/
+coverage/
+test/typescript/axios.js*
+sauce_connect.log
+package-lock.json
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..09739a3
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,18 @@
+**/.*
+*.iml
+coverage/
+examples/
+node_modules/
+typings/
+sandbox/
+test/
+bower.json
+CODE_OF_CONDUCT.md
+COLLABORATOR_GUIDE.md
+CONTRIBUTING.md
+COOKBOOK.md
+ECOSYSTEM.md
+Gruntfile.js
+karma.conf.js
+webpack.*.js
+sauce_connect.log
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..51040e4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+services:
+ - xvfb
+language: node_js
+node_js:
+ - 10
+ - 12
+ - 14
+email:
+ on_failure: change
+ on_success: never
+after_success:
+- npm run coveralls
+env:
+ global:
+ - secure: LlXIBEaBLgJznkHWfTV6aftkGoBjH2vik4ZQhKq4k5pvoPLD+n5n28+0bjwlzDIHUdHb+n2YXtyM2PGvGzuqwltV+UY1gu0uG2RNR+5CBsp0pOr0FfGXK6YMXn0BYER6tGYIhaG7ElHBEO0SLcQeQV/xN/m3leyawbKEMBUGizU=
+ - secure: XbXYzVddHJSVdbJRd/YtsdNu6Wlgx3pXvpuBpg9qBc3TytAF4LzhJNI8u1p4D1Gn8wANlxv1GNgEgkecxbzlTPST+mUrd6KlPLa1+Cmffgajr4oQjsh9ILKMe5Haqx8FOVrPK/leB1mi52liNLlkuo3/BK2r/tC2kMji+2zbses=
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..6f11ac1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,685 @@
+# Changelog
+
+### 0.21.1 (December 21, 2020)
+
+Fixes and Functionality:
+
+- Hotfix: Prevent SSRF (#3410)
+- Protocol not parsed when setting proxy config from env vars (#3070)
+- Updating axios in types to be lower case (#2797)
+- Adding a type guard for `AxiosError` (#2949)
+
+Internal and Tests:
+
+- Remove the skipping of the `socket` http test (#3364)
+- Use different socket for Win32 test (#3375)
+
+Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
+
+- Daniel Lopretto <timemachine3030@users.noreply.github.com>
+- Jason Kwok <JasonHK@users.noreply.github.com>
+- Jay <jasonsaayman@gmail.com>
+- Jonathan Foster <jonathan@jonathanfoster.io>
+- Remco Haszing <remcohaszing@gmail.com>
+- Xianming Zhong <chinesedfan@qq.com>
+
+### 0.21.0 (October 23, 2020)
+
+Fixes and Functionality:
+
+- Fixing requestHeaders.Authorization ([#3287](https://github.com/axios/axios/pull/3287))
+- Fixing node types ([#3237](https://github.com/axios/axios/pull/3237))
+- Fixing axios.delete ignores config.data ([#3282](https://github.com/axios/axios/pull/3282))
+- Revert "Fixing overwrite Blob/File type as Content-Type in browser. (#1773)" ([#3289](https://github.com/axios/axios/pull/3289))
+- Fixing an issue that type 'null' and 'undefined' is not assignable to validateStatus when typescript strict option is enabled ([#3200](https://github.com/axios/axios/pull/3200))
+
+Internal and Tests:
+
+- Lock travis to not use node v15 ([#3361](https://github.com/axios/axios/pull/3361))
+
+Documentation:
+
+- Fixing simple typo, existant -> existent ([#3252](https://github.com/axios/axios/pull/3252))
+- Fixing typos ([#3309](https://github.com/axios/axios/pull/3309))
+
+Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
+
+- Allan Cruz <57270969+Allanbcruz@users.noreply.github.com>
+- George Cheng <Gerhut@GMail.com>
+- Jay <jasonsaayman@gmail.com>
+- Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
+- Remco Haszing <remcohaszing@gmail.com>
+- Taemin Shin <cprayer13@gmail.com>
+- Tim Gates <tim.gates@iress.com>
+- Xianming Zhong <chinesedfan@qq.com>
+
+### 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)
+
+Fixes and Functionality:
+
+- Fixing response with utf-8 BOM can not parse to json ([#2419](https://github.com/axios/axios/pull/2419))
+ - fix: remove byte order marker (UTF-8 BOM) when transform response
+ - fix: remove BOM only utf-8
+ - test: utf-8 BOM
+ - fix: incorrect param name
+- Refactor mergeConfig without utils.deepMerge ([#2844](https://github.com/axios/axios/pull/2844))
+ - Adding failing test
+ - Fixing #2587 default custom config persisting
+ - Adding Concat keys and filter duplicates
+ - Fixed value from CPE
+ - update for review feedbacks
+ - no deepMerge
+ - only merge between plain objects
+ - fix rename
+ - always merge config by mergeConfig
+ - extract function mergeDeepProperties
+ - refactor mergeConfig with all keys, and add special logic for validateStatus
+ - add test for resetting headers
+ - add lots of tests and fix a bug
+ - should not inherit `data`
+ - use simple toString
+- Fixing overwrite Blob/File type as Content-Type in browser. ([#1773](https://github.com/axios/axios/pull/1773))
+- Fixing an issue that type 'null' is not assignable to validateStatus ([#2773](https://github.com/axios/axios/pull/2773))
+- Fixing special char encoding ([#1671](https://github.com/axios/axios/pull/1671))
+ - removing @ character from replacement list since it is a reserved character
+ - Updating buildURL test to not include the @ character
+ - Removing console logs
+- Fixing password encoding with special characters in basic authentication ([#1492](https://github.com/axios/axios/pull/1492))
+ - Fixing password encoding with special characters in basic authentication
+ - Adding test to check if password with non-Latin1 characters pass
+- Fixing 'Network Error' in react native android ([#1487](https://github.com/axios/axios/pull/1487))
+ There is a bug in react native Android platform when using get method. It will trigger a 'Network Error' when passing the requestData which is an empty string to request.send function. So if the requestData is an empty string we can set it to null as well to fix the bug.
+- Fixing Cookie Helper with Asyc Components ([#1105](https://github.com/axios/axios/pull/1105)) ([#1107](https://github.com/axios/axios/pull/1107))
+- Fixing 'progressEvent' type ([#2851](https://github.com/axios/axios/pull/2851))
+ - Fix 'progressEvent' type
+ - Update axios.ts
+- Fixing getting local files (file://) failed ([#2470](https://github.com/axios/axios/pull/2470))
+ - fix issue #2416, #2396
+ - fix Eslint warn
+ - Modify judgment conditions
+ - add unit test
+ - update unit test
+ - update unit test
+- Allow PURGE method in typings ([#2191](https://github.com/axios/axios/pull/2191))
+- Adding option to disable automatic decompression ([#2661](https://github.com/axios/axios/pull/2661))
+ - Adding ability to disable auto decompression
+ - Updating decompress documentation in README
+ - Fixing test\unit\adapters\http.js lint errors
+ - Adding test for disabling auto decompression
+ - Removing changes that fixed lint errors in tests
+ - Removing formatting change to unit test
+- Add independent `maxBodyLength` option ([#2781](https://github.com/axios/axios/pull/2781))
+ - Add independent option to set the maximum size of the request body
+ - Remove maxBodyLength check
+ - Update README
+ - Assert for error code and message
+- Adding responseEncoding to mergeConfig ([#1745](https://github.com/axios/axios/pull/1745))
+- Compatible with follow-redirect aborts the request ([#2689](https://github.com/axios/axios/pull/2689))
+ - Compatible with follow-redirect aborts the request
+ - Use the error code
+- Fix merging of params ([#2656](https://github.com/axios/axios/pull/2656))
+ - Name function to avoid ESLint func-names warning
+ - Switch params config to merge list and update tests
+ - Restore testing of both false and null
+ - Restore test cases for keys without defaults
+ - Include test for non-object values that aren't false-y.
+- Revert `finally` as `then` ([#2683](https://github.com/axios/axios/pull/2683))
+
+Internal and Tests:
+
+- Fix stale bot config ([#3049](https://github.com/axios/axios/pull/3049))
+ - fix stale bot config
+ - fix multiple lines
+- Add days and change name to work ([#3035](https://github.com/axios/axios/pull/3035))
+- Update close-issues.yml ([#3031](https://github.com/axios/axios/pull/3031))
+ - Update close-issues.yml
+ Update close message to read better 😄
+ - Fix use of quotations
+ Use single quotes as per other .yml files
+ - Remove user name form message
+- Add GitHub actions to close stale issues/prs ([#3029](https://github.com/axios/axios/pull/3029))
+ - prepare stale actions
+ - update messages
+ - Add exempt labels and lighten up comments
+- Add GitHub actions to close invalid issues ([#3022](https://github.com/axios/axios/pull/3022))
+ - add close actions
+ - fix with checkout
+ - update issue templates
+ - add reminder
+ - update close message
+- Add test with Node.js 12 ([#2860](https://github.com/axios/axios/pull/2860))
+ - test with Node.js 12
+ - test with latest
+- Adding console log on sandbox server startup ([#2210](https://github.com/axios/axios/pull/2210))
+ - Adding console log on sandbox server startup
+ - Update server.js
+ Add server error handling
+ - Update server.js
+ Better error message, remove retry.
+- Adding tests for method `options` type definitions ([#1996](https://github.com/axios/axios/pull/1996))
+ Update tests.
+- Add test for redirecting with too large response ([#2695](https://github.com/axios/axios/pull/2695))
+- Fixing unit test failure in Windows OS ([#2601](https://github.com/axios/axios/pull/2601))
+- Fixing issue for HEAD method and gzipped response ([#2666](https://github.com/axios/axios/pull/2666))
+- Fix tests in browsers ([#2748](https://github.com/axios/axios/pull/2748))
+- chore: add `jsdelivr` and `unpkg` support ([#2443](https://github.com/axios/axios/pull/2443))
+
+Documentation:
+
+- Adding support for URLSearchParams in node ([#1900](https://github.com/axios/axios/pull/1900))
+ - Adding support for URLSearchParams in node
+ - Remove un-needed code
+ - Update utils.js
+ - Make changes as suggested
+- Adding table of content (preview) ([#3050](https://github.com/axios/axios/pull/3050))
+ - add toc (preview)
+ - remove toc in toc
+ Signed-off-by: Moni <usmoni@gmail.com>
+ - fix sublinks
+ - fix indentation
+ - remove redundant table links
+ - update caps and indent
+ - remove axios
+- Replace 'blacklist' with 'blocklist' ([#3006](https://github.com/axios/axios/pull/3006))
+- docs(): Detailed config options environment. ([#2088](https://github.com/axios/axios/pull/2088))
+ - docs(): Detailed config options environment.
+ - Update README.md
+- Include axios-data-unpacker in ECOSYSTEM.md ([#2080](https://github.com/axios/axios/pull/2080))
+- Allow opening examples in Gitpod ([#1958](https://github.com/axios/axios/pull/1958))
+- Remove axios.all() and axios.spread() from Readme.md ([#2727](https://github.com/axios/axios/pull/2727))
+ - remove axios.all(), axios.spread()
+ - replace example
+ - axios.all() -> Promise.all()
+ - axios.spread(function (acct, perms)) -> function (acct, perms)
+ - add deprecated mark
+- Update README.md ([#2887](https://github.com/axios/axios/pull/2887))
+ Small change to the data attribute doc of the config. A request body can also be set for DELETE methods but this wasn't mentioned in the documentation (it only mentioned POST, PUT and PATCH). Took my some 10-20 minutes until I realized that I don't need to manipulate the request body with transformRequest in the case of DELETE.
+- Include swagger-taxos-codegen in ECOSYSTEM.md ([#2162](https://github.com/axios/axios/pull/2162))
+- Add CDNJS version badge in README.md ([#878](https://github.com/axios/axios/pull/878))
+ This badge will show the version on CDNJS!
+- Documentation update to clear up ambiguity in code examples ([#2928](https://github.com/axios/axios/pull/2928))
+ - Made an adjustment to the documentation to clear up any ambiguity around the use of "fs". This should help clear up that the code examples with "fs" cannot be used on the client side.
+- Update README.md about validateStatus ([#2912](https://github.com/axios/axios/pull/2912))
+ Rewrote the comment from "Reject only if the status code is greater than or equal to 500" to "Resolve only if the status code is less than 500"
+- Updating documentation for usage form-data ([#2805](https://github.com/axios/axios/pull/2805))
+ Closes #2049
+- Fixing CHANGELOG.md issue link ([#2784](https://github.com/axios/axios/pull/2784))
+- Include axios-hooks in ECOSYSTEM.md ([#2003](https://github.com/axios/axios/pull/2003))
+- Added Response header access instructions ([#1901](https://github.com/axios/axios/pull/1901))
+ - Added Response header access instructions
+ - Added note about using bracket notation
+- Add `onUploadProgress` and `onDownloadProgress` are browser only ([#2763](https://github.com/axios/axios/pull/2763))
+ Saw in #928 and #1966 that `onUploadProgress` and `onDownloadProgress` only work in the browser and was missing that from the README.
+- Update ' sign to ` in proxy spec ([#2778](https://github.com/axios/axios/pull/2778))
+- Adding jsDelivr link in README ([#1110](https://github.com/axios/axios/pull/1110))
+ - Adding jsDelivr link
+ - Add SRI
+ - Remove SRI
+
+Huge thanks to everyone who contributed to this release via code (authors listed
+below) or via reviews and triaging on GitHub:
+
+- Alan Wang <wp_scut@163.com>
+- Alexandru Ungureanu <khakcarot@gmail.com>
+- Anubhav Srivastava <anubhav.srivastava00@gmail.com>
+- Benny Neugebauer <bn@bennyn.de>
+- Cr <631807682@qq.com>
+- David <cygnidavid@gmail.com>
+- David Ko <david.ko@pvtmethod.com>
+- David Tanner <david.tanner@lifeomic.com>
+- Emily Morehouse <emilyemorehouse@gmail.com>
+- Felipe Martins <felipewmartins@gmail.com>
+- Fonger <5862369+Fonger@users.noreply.github.com>
+- Frostack <soulburn007@gmail.com>
+- George Cheng <Gerhut@GMail.com>
+- grumblerchester <grumblerchester@users.noreply.github.com>
+- Gustavo López <gualopezb@gmail.com>
+- hexaez <45806662+hexaez@users.noreply.github.com>
+- huangzuizui <huangzuizui@gmail.com>
+- Ian Wijma <ian@wij.ma>
+- Jay <jasonsaayman@gmail.com>
+- jeffjing <zgayjjf@qq.com>
+- jennynju <46782518+jennynju@users.noreply.github.com>
+- Jimmy Liao <52391190+jimmy-liao-gogoro@users.noreply.github.com>
+- Jonathan Sharpe <j.r.sharpe@gmail.com>
+- JounQin <admin@1stg.me>
+- Justin Beckwith <justin.beckwith@gmail.com>
+- Kamil Posiadała <3dcreator.pl@gmail.com>
+- Lukas Drgon <lukas.drgon@gmail.com>
+- marcinx <mail@marcinx.com>
+- Martti Laine <martti@codeclown.net>
+- Michał Zarach <michal.m.zarach@gmail.com>
+- Moni <usmoni@gmail.com>
+- Motonori Iwata <121048+iwata@users.noreply.github.com>
+- Nikita Galkin <nikita@galk.in>
+- Petr Mares <petr@mares.tw>
+- Philippe Recto <precto1285@gmal.com>
+- Remco Haszing <remcohaszing@gmail.com>
+- rockcs1992 <chengshi1219@gmail.com>
+- Ryan Bown <rbown@niftee.com.au>
+- Samina Fu <sufuf3@gmail.com>
+- Simone Busoli <simone.busoli@gmail.com>
+- Spencer von der Ohe <s.vonderohe40@gmail.com>
+- Sven Efftinge <sven.efftinge@typefox.io>
+- Taegyeoung Oh <otk1090@naver.com>
+- Taemin Shin <cprayer13@gmail.com>
+- Thibault Ehrhart <1208424+ehrhart@users.noreply.github.com>
+- Xianming Zhong <chinesedfan@qq.com>
+- Yasu Flores <carlosyasu91@gmail.com>
+- Zac Delventhal <delventhalz@gmail.com>
+
+### 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)
+
+Fixes and Functionality:
+
+- Fixing invalid agent issue ([#1904](https://github.com/axios/axios/pull/1904))
+- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
+- Delete useless default to hash ([#2458](https://github.com/axios/axios/pull/2458))
+- Fix HTTP/HTTPs agents passing to follow-redirect ([#1904](https://github.com/axios/axios/pull/1904))
+- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
+- Fix CI build failure ([#2570](https://github.com/axios/axios/pull/2570))
+- Remove dependency on is-buffer from package.json ([#1816](https://github.com/axios/axios/pull/1816))
+- Adding options typings ([#2341](https://github.com/axios/axios/pull/2341))
+- Adding Typescript HTTP method definition for LINK and UNLINK. ([#2444](https://github.com/axios/axios/pull/2444))
+- Update dist with newest changes, fixes Custom Attributes issue
+- Change syntax to see if build passes ([#2488](https://github.com/axios/axios/pull/2488))
+- Update Webpack + deps, remove now unnecessary polyfills ([#2410](https://github.com/axios/axios/pull/2410))
+- Fix to prevent XSS, throw an error when the URL contains a JS script ([#2464](https://github.com/axios/axios/pull/2464))
+- Add custom timeout error copy in config ([#2275](https://github.com/axios/axios/pull/2275))
+- Add error toJSON example ([#2466](https://github.com/axios/axios/pull/2466))
+- Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… ([#2451](https://github.com/axios/axios/pull/2451))
+- Fixing subdomain handling on no_proxy ([#2442](https://github.com/axios/axios/pull/2442))
+- Make redirection from HTTP to HTTPS work ([#2426](https://github.com/axios/axios/pull/2426)) and ([#2547](https://github.com/axios/axios/pull/2547))
+- Add toJSON property to AxiosError type ([#2427](https://github.com/axios/axios/pull/2427))
+- Fixing socket hang up error on node side for slow response. ([#1752](https://github.com/axios/axios/pull/1752))
+- Alternative syntax to send data into the body ([#2317](https://github.com/axios/axios/pull/2317))
+- Fixing custom config options ([#2207](https://github.com/axios/axios/pull/2207))
+- Fixing set `config.method` after mergeConfig for Axios.prototype.request ([#2383](https://github.com/axios/axios/pull/2383))
+- Axios create url bug ([#2290](https://github.com/axios/axios/pull/2290))
+- Do not modify config.url when using a relative baseURL (resolves [#1628](https://github.com/axios/axios/issues/1098)) ([#2391](https://github.com/axios/axios/pull/2391))
+- Add typescript HTTP method definition for LINK and UNLINK ([#2444](https://github.com/axios/axios/pull/2444))
+
+Internal:
+
+- Revert "Update Webpack + deps, remove now unnecessary polyfills" ([#2479](https://github.com/axios/axios/pull/2479))
+- Order of if/else blocks is causing unit tests mocking XHR. ([#2201](https://github.com/axios/axios/pull/2201))
+- Add license badge ([#2446](https://github.com/axios/axios/pull/2446))
+- Fix travis CI build [#2386](https://github.com/axios/axios/pull/2386)
+- Fix cancellation error on build master. #2290 #2207 ([#2407](https://github.com/axios/axios/pull/2407))
+
+Documentation:
+
+- Fixing typo in CHANGELOG.md: s/Functionallity/Functionality ([#2639](https://github.com/axios/axios/pull/2639))
+- Fix badge, use master branch ([#2538](https://github.com/axios/axios/pull/2538))
+- Fix typo in changelog [#2193](https://github.com/axios/axios/pull/2193)
+- Document fix ([#2514](https://github.com/axios/axios/pull/2514))
+- Update docs with no_proxy change, issue #2484 ([#2513](https://github.com/axios/axios/pull/2513))
+- Fixing missing words in docs template ([#2259](https://github.com/axios/axios/pull/2259))
+- 🐛Fix request finally documentation in README ([#2189](https://github.com/axios/axios/pull/2189))
+- updating spelling and adding link to docs ([#2212](https://github.com/axios/axios/pull/2212))
+- docs: minor tweak ([#2404](https://github.com/axios/axios/pull/2404))
+- Update response interceptor docs ([#2399](https://github.com/axios/axios/pull/2399))
+- Update README.md ([#2504](https://github.com/axios/axios/pull/2504))
+- Fix word 'sintaxe' to 'syntax' in README.md ([#2432](https://github.com/axios/axios/pull/2432))
+- updating README: notes on CommonJS autocomplete ([#2256](https://github.com/axios/axios/pull/2256))
+- Fix grammar in README.md ([#2271](https://github.com/axios/axios/pull/2271))
+- Doc fixes, minor examples cleanup ([#2198](https://github.com/axios/axios/pull/2198))
+
+### 0.19.0 (May 30, 2019)
+
+Fixes and Functionality:
+
+- Added support for no_proxy env variable ([#1693](https://github.com/axios/axios/pull/1693/files)) - Chance Dickson
+- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
+- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issues/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
+- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
+- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
+- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
+- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
+- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
+- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
+- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
+- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
+
+Internal:
+
+- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
+- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
+- Add issue templates - Emily Morehouse
+
+Documentation:
+
+- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
+- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
+- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho
+- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
+- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX
+- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes
+- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty
+- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai
+- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
+- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
+- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser
+- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
+- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
+- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
+
+### 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.
+
+New Functionality:
+
+- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712))
+- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693))
+- Add toJSON to decorated Axios errors to facilitate serialization ([#1625](https://github.com/axios/axios/issues/1625))
+- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
+- Typings: allow custom return types
+- Add option to specify character set in responses (with http adapter)
+
+Fixes:
+
+- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
+- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
+- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
+- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
+- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
+- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
+ - Fixing defaults to use httpAdapter if available
+ - Use a safer, cross-platform method to detect the Node environment
+- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
+- [Typescript] Fix missing type parameters on delete/head methods
+- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
+- Fix missing type parameters on delete/head
+- Fix Default method for an instance always overwritten by get
+- Fix type error when socketPath option in AxiosRequestConfig
+- Capture errors on request data streams
+- Decorate resolve and reject to clear timeout in all cases
+
+Huge thanks to everyone who contributed to this release via code (authors listed
+below) or via reviews and triaging on GitHub:
+
+- Andrew Scott <ascott18@gmail.com>
+- Anthony Gauthier <antho325@hotmail.com>
+- arpit <arpit2438735@gmail.com>
+- ascott18
+- Benedikt Rötsch <axe312ger@users.noreply.github.com>
+- Chance Dickson <me@chancedickson.com>
+- Dave Stewart <info@davestewart.co.uk>
+- Deric Cain <deric.cain@gmail.com>
+- Guillaume Briday <guillaumebriday@gmail.com>
+- Jacob Wejendorp <jacob@wejendorp.dk>
+- Jim Lynch <mrdotjim@gmail.com>
+- johntron
+- Justin Beckwith <beckwith@google.com>
+- Justin Beckwith <justin.beckwith@gmail.com>
+- Khaled Garbaya <khaledgarbaya@gmail.com>
+- Lim Jing Rong <jjingrong@users.noreply.github.com>
+- Mark van den Broek <mvdnbrk@gmail.com>
+- Martti Laine <martti@codeclown.net>
+- mattridley
+- mattridley <matt.r@joinblink.com>
+- Nicolas Del Valle <nicolas.delvalle@gmail.com>
+- Nilegfx
+- pbarbiero
+- Rikki Gibson <rikkigibson@gmail.com>
+- Sako Hartounian <sakohartounian@yahoo.com>
+- Shane Fitzpatrick <fitzpasd@gmail.com>
+- Stephan Schneider <stephanschndr@gmail.com>
+- Steven <steven@ceriously.com>
+- Tim Garthwaite <tim.garthwaite@jibo.com>
+- Tim Johns <timjohns@yahoo.com>
+- Yutaro Miyazaki <yutaro@studio-rubbish.com>
+
+### 0.18.0 (Feb 19, 2018)
+
+- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
+- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
+ - AxiosRequestConfig.proxy: allows type false
+ - AxiosProxyConfig: added auth field
+- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254))
+- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
+- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
+
+### 0.17.1 (Nov 11, 2017)
+
+- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
+- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
+- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
+
+### 0.17.0 (Oct 21, 2017)
+
+- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
+- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
+- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
+- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
+
+### 0.16.2 (Jun 3, 2017)
+
+- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
+- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
+- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
+
+### 0.16.1 (Apr 8, 2017)
+
+- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
+- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
+- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
+
+### 0.16.0 (Mar 31, 2017)
+
+- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
+- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
+- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
+- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
+- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
+- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
+
+### 0.15.3 (Nov 27, 2016)
+
+- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
+- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
+- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
+- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
+- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
+- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
+- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
+
+### 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)
+
+- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
+
+### 0.15.0 (Oct 10, 2016)
+
+- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
+- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
+- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
+- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
+
+### 0.14.0 (Aug 27, 2016)
+
+- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
+- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
+- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
+- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
+- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
+- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
+
+### 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)
+
+- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
+- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
+- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
+- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
+- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
+- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
+- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
+
+### 0.12.0 (May 31, 2016)
+
+- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
+- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
+
+### 0.11.1 (May 17, 2016)
+
+- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
+- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
+- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
+
+### 0.11.0 (Apr 26, 2016)
+
+- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
+- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
+- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
+
+### 0.10.0 (Apr 20, 2016)
+
+- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
+- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
+- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
+- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
+- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
+- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
+- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
+- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
+
+### 0.9.1 (Jan 24, 2016)
+
+- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
+- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
+- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
+- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
+
+### 0.9.0 (Jan 18, 2016)
+
+- Adding support for custom adapters
+- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
+- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
+- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
+- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
+
+### 0.8.1 (Dec 14, 2015)
+
+- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
+- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
+- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
+
+### 0.8.0 (Dec 11, 2015)
+
+- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
+- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
+- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
+- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
+- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
+- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
+- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
+- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
+- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
+
+### 0.7.0 (Sep 29, 2015)
+
+- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
+- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
+- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
+- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
+- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
+- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
+- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
+
+### 0.6.0 (Sep 21, 2015)
+
+- Removing deprecated success/error aliases
+- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
+- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
+- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
+- Removing es6-promise dependency
+- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
+- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
+- Converting build to UMD
+
+### 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)
+
+- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
+
+### 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)
+
+- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
+- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
+
+### 0.5.0 (Jan 23, 2015)
+
+- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
+- Updating es6-promise dependency
+
+### 0.4.2 (Dec 10, 2014)
+
+- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
+- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
+- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
+- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
+
+### 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)
+
+- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
+- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
+- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
+- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
+- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
+- Deprecating `success`/`error` in favor of `then`/`catch`
+
+### 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)
+
+- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
+- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
+- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
+
+### 0.2.2 (Sep 14, 2014)
+
+- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
+
+### 0.2.1 (Sep 12, 2014)
+
+- Fixing build problem causing ridiculous file sizes
+
+### 0.2.0 (Sep 12, 2014)
+
+- Adding support for `all` and `spread`
+- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
+
+### 0.1.0 (Aug 29, 2014)
+
+- Initial release
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..7f81ae4
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at mzabriskie@gmail.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/ \ No newline at end of file
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md
new file mode 100644
index 0000000..2bc7cb6
--- /dev/null
+++ b/COLLABORATOR_GUIDE.md
@@ -0,0 +1,23 @@
+# Collaborator Guide
+
+As a collaborator you will be involved with axios with some administrative responsibilities. This guide will help you understand your role and the responsibilities that come with being a collaborator.
+
+1. __Adhere to and help enforce the Code of Conduct.__ It is expected that you have read the [code of conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md) and that you agree to live by it. This community should be friendly and welcoming.
+
+1. __Triage issues.__ As a collaborator you may help sort through the issues that are reported. Issues vary from bugs, regressions, feature requests, questions, etc. Apply the appropriate label(s) and respond as needed. If it is a legitimate request please address it, otherwise feel free to close the issue and include a comment with a suggestion on where to find support. If an issue has been inactive for more than a week (i.e, the owner of the issue hasn’t responded to you), close the issue with a note indicating stales issues are closed; it can always be reopened if needed. In the case of issues that require a code change encourage the owner to submit a PR. For less complex code changes, add a very simple and detailed checklist, apply the “first-timers-only” label, and encourage a newcomer to open source to get involved.
+
+1. __Answer questions.__ It is not expected that you provide answers to questions that aren’t relevant, nor do you need to mentor people on how to use JavaScript, etc. If the question is not directly about the module, please close the issue. If the question stems from poor documentation, please update the docs and consider adding a code example. In any event try to be helpful and remember that there’s no such thing as a stupid question.
+
+1. __Assist with PRs.__ By encouraging contributors to supply a PR for their own issue this is ideally where most of your attention will be focused. Keep a few things in mind as you review PRs.
+ - When fixing a bug: does the PR adequately solve the problem without introducing any regressions?
+ - When implementing a feature: does the feature fit within the scope of axios?
+ - When removing functionality: is it properly deprecated with a warning?
+ - When introducing functionality: is the API predictable?
+ - Does the new code work for all supported platforms/browsers?
+ - Do the tests and linting pass CI?
+ - Are there tests to validate the changes that have been made?
+
+1. __Fix bugs and implement features.__ When things need to be fixed or implemented and a PR can’t wait, you may do things yourself. You should still submit a PR yourself and get it checked off by at least one other contributor. Keep the points from number 4 in consideration as you push your code.
+
+Thank you again for your help as a collaborator and in making axios community great! If you have any questions, or need any assistance please feel free to contact another collaborator or the owner.
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..43dc8fd
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,66 @@
+# Contributing
+
+We are open to, and grateful for, any contributions made by the community. By contributing to axios, you agree to abide by the [code of conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md).
+
+### Code Style
+
+Please follow the [node style guide](https://github.com/felixge/node-style-guide).
+
+### Commit Messages
+
+Commit messages should be verb based, using the following pattern:
+
+- `Fixing ...`
+- `Adding ...`
+- `Updating ...`
+- `Removing ...`
+
+### Testing
+
+Please update the tests to reflect your code changes. Pull requests will not be accepted if they are failing on [Travis CI](https://travis-ci.org/axios/axios).
+
+### Documentation
+
+Please update the [docs](README.md) accordingly so that there are no discrepancies between the API and the documentation.
+
+### Developing
+
+- `grunt test` run the jasmine and mocha tests
+- `grunt build` run webpack and bundle the source
+- `grunt version` prepare the code for release
+- `grunt watch:test` watch for changes and run `test`
+- `grunt watch:build` watch for changes and run `build`
+
+Please don't include changes to `dist/` in your pull request. This should only be updated when releasing a new version.
+
+### Releasing
+
+Releasing a new version is mostly automated. For now the [CHANGELOG](https://github.com/axios/axios/blob/master/CHANGELOG.md) requires being updated manually. Once this has been done run the commands below. Versions should follow [semantic versioning](http://semver.org/).
+
+- `npm version <newversion> -m "Releasing %s"`
+- `npm publish`
+
+### Running Examples
+
+Examples are included in part to allow manual testing.
+
+Running example
+
+```bash
+$ npm run examples
+# Open 127.0.0.1:3000
+```
+
+Running sandbox in browser
+
+```bash
+$ npm start
+# Open 127.0.0.1:3000
+```
+
+Running sandbox in terminal
+
+```bash
+$ npm start
+$ node ./sandbox/client
+```
diff --git a/COOKBOOK.md b/COOKBOOK.md
new file mode 100644
index 0000000..3f4debd
--- /dev/null
+++ b/COOKBOOK.md
@@ -0,0 +1,126 @@
+# Cookbook
+
+This cookbook contains recipes for some commonly requested features.
+
+In order to keep axios as lightweight as possible, it is often necessary to say no to feature requests. Many of these use cases can be supported by augmenting axios with other libraries.
+
+### Promise.prototype.done
+
+```bash
+$ npm install axios promise --save
+```
+
+```js
+const axios = require('axios');
+require('promise/polyfill-done');
+
+axios
+ .get('http://www.example.com/user')
+ .then((response) => {
+ console.log(response.data);
+ return response;
+ })
+ .done();
+```
+
+### Promise.prototype.finally
+
+```bash
+$ npm install axios promise.prototype.finally --save
+```
+
+```js
+const axios = require('axios');
+require('promise.prototype.finally').shim();
+
+axios
+ .get('http://www.example.com/user')
+ .then((response) => {
+ console.log(response.data);
+ return response;
+ })
+ .finally(() => {
+ console.log('this will always be called');
+ });
+```
+
+### Inflate/Deflate
+
+```bash
+$ npm install axios pako --save
+```
+
+```js
+// client.js
+const axios = require('axios');
+const pako = require('pako');
+
+const user = {
+ firstName: 'Fred',
+ lastName: 'Flintstone'
+};
+
+const data = pako.deflate(JSON.stringify(user), { to: 'string' });
+
+axios
+ .post('http://127.0.0.1:3333/user', data)
+ .then((response) => {
+ response.data = JSON.parse(pako.inflate(response.data, { to: 'string' }));
+ console.log(response.data);
+ return response;
+ });
+```
+
+```js
+// server.js
+const pako = require('pako');
+const http = require('http');
+const url = require('url');
+
+const server = http.createServer((req, res) => {
+ req.setEncoding('utf8');
+
+ const parsed = url.parse(req.url, true);
+ const pathname = parsed.pathname;
+
+ if (pathname === '/user') {
+ let data = '';
+ req.on('data', (chunk) => {
+ data += chunk;
+ });
+
+ req.on('end', () => {
+ const user = JSON.parse(pako.inflate(data, { to: 'string' }));
+ console.log(user);
+
+ res.writeHead(200, {
+ 'Content-Type': 'application/json'
+ });
+ res.end(pako.deflate(JSON.stringify({result: 'success'}), { to: 'string' }));
+ });
+ } else {
+ res.writeHead(404);
+ res.end(pako.deflate(JSON.stringify({result: 'error'}), { to: 'string' }));
+ }
+});
+
+server.listen(3333);
+```
+
+### JSONP
+
+```bash
+$ npm install jsonp --save
+```
+
+```js
+const jsonp = require('jsonp');
+
+jsonp('http://www.example.com/foo', null, (err, data) => {
+ if (err) {
+ console.error(err.message);
+ } else {
+ console.log(data);
+ }
+});
+```
diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md
new file mode 100644
index 0000000..9c72645
--- /dev/null
+++ b/ECOSYSTEM.md
@@ -0,0 +1,40 @@
+# Ecosystem
+
+This is a list of axios related libraries and resources. If you have a suggestion on what to add, please don't hesitate to submit a PR.
+
+## Libraries
+
+### General
+
+* [axios-vcr](https://github.com/nettofarah/axios-vcr) - 📼 Record and Replay Axios requests
+* [@3846masa/axios-cookiejar-support](https://github.com/3846masa/axios-cookiejar-support) - Add tough-cookie support to axios
+* [axios-method-override](https://github.com/jacobbuck/axios-method-override) - Axios http request method override plugin
+* [axios-cache-plugin](https://github.com/jin5354/axios-cache-plugin) - Help you cache GET request when using axios.
+* [axios-extensions](https://github.com/kuitos/axios-extensions) - A collection of axios extensions, including throttle and cache GET request plugin.
+* [axios-fetch](https://github.com/lifeomic/axios-fetch) - A WebAPI Fetch implementation backed by an Axios client
+* [axios-actions](https://github.com/davestewart/axios-actions) - Bundle endpoints as callable, reusable services
+* [axios-api-versioning](https://weffe.github.io/axios-api-versioning) - Add easy to manage api versioning to axios
+* [axios-data-unpacker](https://github.com/anubhavsrivastava/axios-data-unpacker) - Axios interceptor that unpacks HTTP responses so that you can focus on actual server data.
+* [r2curl](https://github.com/uyu423/r2curl) - Extracts the cURL command string from the Axios object. (AxiosResponse, AxiosRequestConfig)
+* [swagger-taxos-codegen](https://github.com/michalzaq12/swagger-taxos-codegen) - Axios based Swagger Codegen (tailored for typescript)
+* [axios-endpoints](https://github.com/renancaraujo/axios-endpoints) - Axios endpoints helps you to create a more concise endpoint mapping with axios.
+
+### Logging and debugging
+
+* [axios-response-logger](https://github.com/srph/axios-response-logger) - Axios interceptor which logs responses
+* [axios-debug-log](https://github.com/Gerhut/axios-debug-log) - Axios interceptor of logging requests & responses by debug.
+* [axios-curlirize](https://www.npmjs.com/package/axios-curlirize) - Logs axios requests as curl commands, also adds a property to the response object with the curl command as value.
+
+### React and redux
+
+* [axios-hooks](https://github.com/simoneb/axios-hooks) - 🦆 React hooks for axios, with built-in support for server side rendering
+* [react-hooks-axios](https://github.com/use-hooks/react-hooks-axios) - Custom React Hooks for Axios.js
+* [redux-saga-requests](https://github.com/klis87/redux-saga-requests) - Redux-Saga addon to simplify handling of AJAX requests.
+* [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) - Redux middleware for fetching data with axios HTTP client
+
+### Unit testing
+
+* [axiosist](https://github.com/Gerhut/axiosist) - Axios based supertest: convert node.js request handler to axios adapter, used for node.js server unit test.
+* [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) — Axios adapter that allows to easily mock requests
+* [moxios](https://github.com/axios/moxios) - Mock axios requests for testing
+* [mocha-axios](https://github.com/jdrydn/mocha-axios) - Streamlined integration testing with Mocha & Axios
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..3f52745
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,107 @@
+module.exports = function(grunt) {
+ require('load-grunt-tasks')(grunt);
+
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ meta: {
+ banner: '/* <%= pkg.name %> v<%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> by Matt Zabriskie */\n'
+ },
+
+ clean: {
+ dist: 'dist/**'
+ },
+
+ ts: {
+ test: {
+ options: {
+ lib: [
+ 'es5',
+ 'es2015.promise',
+ 'dom'
+ ]
+ },
+ src: ['typings/index.d.ts', 'test/typescript/*.ts']
+ }
+ },
+
+ package2bower: {
+ all: {
+ fields: [
+ 'name',
+ 'description',
+ 'version',
+ 'homepage',
+ 'license',
+ 'keywords'
+ ]
+ }
+ },
+
+ usebanner: {
+ all: {
+ options: {
+ banner: '<%= meta.banner %>',
+ linebreak: false
+ },
+ files: {
+ src: ['dist/*.js']
+ }
+ }
+ },
+
+ eslint: {
+ target: ['lib/**/*.js']
+ },
+
+ karma: {
+ options: {
+ configFile: 'karma.conf.js'
+ },
+ single: {
+ singleRun: true
+ },
+ continuous: {
+ singleRun: false
+ }
+ },
+
+ mochaTest: {
+ test: {
+ src: ['test/unit/**/*.js']
+ },
+ options: {
+ timeout: 30000,
+ },
+ },
+
+ watch: {
+ build: {
+ files: ['lib/**/*.js'],
+ tasks: ['build']
+ },
+ test: {
+ files: ['lib/**/*.js', 'test/**/*.js', '!test/typescript/axios.js', '!test/typescript/out.js'],
+ tasks: ['test']
+ }
+ },
+
+ webpack: require('./webpack.config.js')
+ });
+
+ grunt.registerMultiTask('package2bower', 'Sync package.json to bower.json', function () {
+ var npm = grunt.file.readJSON('package.json');
+ var bower = grunt.file.readJSON('bower.json');
+ var fields = this.data.fields || [];
+
+ for (var i=0, l=fields.length; i<l; i++) {
+ var field = fields[i];
+ bower[field] = npm[field];
+ }
+
+ grunt.file.write('bower.json', JSON.stringify(bower, null, 2));
+ });
+
+ grunt.registerTask('test', 'Run the jasmine and mocha tests', ['eslint', 'mochaTest', 'karma:single', 'ts']);
+ grunt.registerTask('build', 'Run webpack and bundle the source', ['clean', 'webpack']);
+ grunt.registerTask('version', 'Sync version info for a release', ['usebanner', 'package2bower']);
+};
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d36c80e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2014-present Matt Zabriskie
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100755
index 0000000..44264f6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,800 @@
+# axios
+
+[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
+[![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios)
+[![build status](https://img.shields.io/travis/axios/axios/master.svg?style=flat-square)](https://travis-ci.org/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)
+[![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)
+
+Promise based HTTP client for the browser and node.js
+## Table of Contents
+
+ - [Features](#features)
+ - [Browser Support](#browser-support)
+ - [Installing](#installing)
+ - [Example](#example)
+ - [Axios API](#axios-api)
+ - [Request method aliases](#request-method-aliases)
+ - [Concurrency (Deprecated)](#concurrency-deprecated)
+ - [Creating an instance](#creating-an-instance)
+ - [Instance methods](#instance-methods)
+ - [Request Config](#request-config)
+ - [Response Schema](#response-schema)
+ - [Config Defaults](#config-defaults)
+ - [Global axios defaults](#global-axios-defaults)
+ - [Custom instance defaults](#custom-instance-defaults)
+ - [Config order of precedence](#config-order-of-precedence)
+ - [Interceptors](#interceptors)
+ - [Handling Errors](#handling-errors)
+ - [Cancellation](#cancellation)
+ - [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)
+ - [Semver](#semver)
+ - [Promises](#promises)
+ - [TypeScript](#typescript)
+ - [Resources](#resources)
+ - [Credits](#credits)
+ - [License](#license)
+
+## Features
+
+- 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
+- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
+- Intercept request and response
+- Transform request and response data
+- Cancel requests
+- Automatic transforms for JSON data
+- Client side support for protecting against [XSRF](http://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) |
+--- | --- | --- | --- | --- | --- |
+Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
+
+[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
+
+## Installing
+
+Using npm:
+
+```bash
+$ npm install axios
+```
+
+Using bower:
+
+```bash
+$ bower install axios
+```
+
+Using yarn:
+
+```bash
+$ yarn add axios
+```
+
+Using jsDelivr CDN:
+
+```html
+<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
+```
+
+Using unpkg CDN:
+
+```html
+<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
+```
+
+## Example
+
+### note: CommonJS usage
+In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
+
+```js
+const axios = require('axios').default;
+
+// axios.<method> will now provide autocomplete and parameter typings
+```
+
+Performing a `GET` request
+
+```js
+const axios = require('axios');
+
+// Make a request for a user with a given ID
+axios.get('/user?ID=12345')
+ .then(function (response) {
+ // handle success
+ console.log(response);
+ })
+ .catch(function (error) {
+ // handle error
+ console.log(error);
+ })
+ .then(function () {
+ // always executed
+ });
+
+// Optionally the request above could also be done as
+axios.get('/user', {
+ params: {
+ ID: 12345
+ }
+ })
+ .then(function (response) {
+ console.log(response);
+ })
+ .catch(function (error) {
+ console.log(error);
+ })
+ .then(function () {
+ // always executed
+ });
+
+// Want to use async/await? Add the `async` keyword to your outer function/method.
+async function getUser() {
+ try {
+ const response = await axios.get('/user?ID=12345');
+ console.log(response);
+ } catch (error) {
+ console.error(error);
+ }
+}
+```
+
+> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
+> Explorer and older browsers, so use with caution.
+
+Performing a `POST` request
+
+```js
+axios.post('/user', {
+ firstName: 'Fred',
+ lastName: 'Flintstone'
+ })
+ .then(function (response) {
+ console.log(response);
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+```
+
+Performing multiple concurrent requests
+
+```js
+function getUserAccount() {
+ return axios.get('/user/12345');
+}
+
+function getUserPermissions() {
+ return axios.get('/user/12345/permissions');
+}
+
+Promise.all([getUserAccount(), getUserPermissions()])
+ .then(function (results) {
+ const acct = results[0];
+ const perm = results[1];
+ });
+```
+
+## axios API
+
+Requests can be made by passing the relevant config to `axios`.
+
+##### axios(config)
+
+```js
+// Send a POST request
+axios({
+ method: 'post',
+ url: '/user/12345',
+ data: {
+ firstName: 'Fred',
+ lastName: 'Flintstone'
+ }
+});
+```
+
+```js
+// GET request for remote image in node.js
+axios({
+ method: 'get',
+ url: 'http://bit.ly/2mTM3nY',
+ responseType: 'stream'
+})
+ .then(function (response) {
+ response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
+ });
+```
+
+##### axios(url[, config])
+
+```js
+// Send a GET request (default method)
+axios('/user/12345');
+```
+
+### Request method aliases
+
+For convenience aliases have been provided for all supported request methods.
+
+##### axios.request(config)
+##### axios.get(url[, config])
+##### axios.delete(url[, config])
+##### axios.head(url[, config])
+##### axios.options(url[, config])
+##### axios.post(url[, data[, config]])
+##### axios.put(url[, data[, config]])
+##### axios.patch(url[, data[, config]])
+
+###### NOTE
+When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
+
+### Concurrency (Deprecated)
+Please use `Promise.all` to replace the below functions.
+
+Helper functions for dealing with concurrent requests.
+
+axios.all(iterable)
+axios.spread(callback)
+
+### Creating an instance
+
+You can create a new instance of axios with a custom config.
+
+##### axios.create([config])
+
+```js
+const instance = axios.create({
+ baseURL: 'https://some-domain.com/api/',
+ timeout: 1000,
+ headers: {'X-Custom-Header': 'foobar'}
+});
+```
+
+### Instance methods
+
+The available instance methods are listed below. The specified config will be merged with the instance config.
+
+##### axios#request(config)
+##### axios#get(url[, config])
+##### axios#delete(url[, config])
+##### axios#head(url[, config])
+##### axios#options(url[, config])
+##### axios#post(url[, data[, config]])
+##### axios#put(url[, data[, config]])
+##### axios#patch(url[, data[, config]])
+##### axios#getUri([config])
+
+## Request Config
+
+These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
+
+```js
+{
+ // `url` is the server URL that will be used for the request
+ url: '/user',
+
+ // `method` is the request method to be used when making the request
+ method: 'get', // default
+
+ // `baseURL` will be prepended to `url` unless `url` is absolute.
+ // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
+ // to methods of that instance.
+ baseURL: 'https://some-domain.com/api/',
+
+ // `transformRequest` allows changes to the request data before it is sent to the server
+ // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
+ // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
+ // FormData or Stream
+ // You may modify the headers object.
+ transformRequest: [function (data, headers) {
+ // Do whatever you want to transform the data
+
+ return data;
+ }],
+
+ // `transformResponse` allows changes to the response data to be made before
+ // it is passed to then/catch
+ transformResponse: [function (data) {
+ // Do whatever you want to transform the data
+
+ return data;
+ }],
+
+ // `headers` are custom headers to be sent
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
+
+ // `params` are the URL parameters to be sent with the request
+ // Must be a plain object or a URLSearchParams object
+ params: {
+ ID: 12345
+ },
+
+ // `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'})
+ },
+
+ // `data` is the data to be sent as the request body
+ // Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
+ // When no `transformRequest` is set, must be of one of the following types:
+ // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
+ // - Browser only: FormData, File, Blob
+ // - Node only: Stream, Buffer
+ data: {
+ firstName: 'Fred'
+ },
+
+ // syntax alternative to send data into the body
+ // method post
+ // only the value is sent, not the key
+ data: 'Country=Brasil&City=Belo Horizonte',
+
+ // `timeout` specifies the number of milliseconds before the request times out.
+ // If the request takes longer than `timeout`, the request will be aborted.
+ timeout: 1000, // default is `0` (no timeout)
+
+ // `withCredentials` indicates whether or not cross-site Access-Control requests
+ // should be made using credentials
+ withCredentials: false, // default
+
+ // `adapter` allows custom handling of requests which makes testing easier.
+ // Return a promise and supply a valid response (see lib/adapters/README.md).
+ adapter: function (config) {
+ /* ... */
+ },
+
+ // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
+ // This will set an `Authorization` header, overwriting any existing
+ // `Authorization` custom headers you have set using `headers`.
+ // Please note that only HTTP Basic auth is configurable through this parameter.
+ // For Bearer tokens and such, use `Authorization` custom headers instead.
+ auth: {
+ username: 'janedoe',
+ password: 's00pers3cret'
+ },
+
+ // `responseType` indicates the type of data that the server will respond with
+ // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
+ // browser only: 'blob'
+ responseType: 'json', // default
+
+ // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
+ // Note: Ignored for `responseType` of 'stream' or client-side requests
+ responseEncoding: 'utf8', // default
+
+ // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
+ xsrfCookieName: 'XSRF-TOKEN', // default
+
+ // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
+ xsrfHeaderName: 'X-XSRF-TOKEN', // default
+
+ // `onUploadProgress` allows handling of progress events for uploads
+ // browser only
+ onUploadProgress: function (progressEvent) {
+ // Do whatever you want with the native progress event
+ },
+
+ // `onDownloadProgress` allows handling of progress events for downloads
+ // browser only
+ onDownloadProgress: function (progressEvent) {
+ // Do whatever you want with the native progress event
+ },
+
+ // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
+ maxContentLength: 2000,
+
+ // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
+ maxBodyLength: 2000,
+
+ // `validateStatus` defines whether to resolve or reject the promise for a given
+ // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
+ // or `undefined`), the promise will be resolved; otherwise, the promise will be
+ // rejected.
+ validateStatus: function (status) {
+ return status >= 200 && status < 300; // default
+ },
+
+ // `maxRedirects` defines the maximum number of redirects to follow in node.js.
+ // If set to 0, no redirects will be followed.
+ maxRedirects: 5, // default
+
+ // `socketPath` defines a UNIX Socket to be used in node.js.
+ // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
+ // Only either `socketPath` or `proxy` can be specified.
+ // If both are specified, `socketPath` is used.
+ socketPath: null, // default
+
+ // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
+ // and https requests, respectively, in node.js. This allows options to be added like
+ // `keepAlive` that are not enabled by default.
+ httpAgent: new http.Agent({ keepAlive: true }),
+ httpsAgent: new https.Agent({ keepAlive: true }),
+
+ // `proxy` defines the hostname, port, and protocol of the proxy server.
+ // You can also define your proxy using the conventional `http_proxy` and
+ // `https_proxy` environment variables. If you are using environment variables
+ // for your proxy configuration, you can also define a `no_proxy` environment
+ // variable as a comma-separated list of domains that should not be proxied.
+ // Use `false` to disable proxies, ignoring environment variables.
+ // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
+ // supplies credentials.
+ // This will set an `Proxy-Authorization` header, overwriting any existing
+ // `Proxy-Authorization` custom headers you have set using `headers`.
+ // If the proxy server uses HTTPS, then you must set the protocol to `https`.
+ proxy: {
+ protocol: 'https',
+ host: '127.0.0.1',
+ port: 9000,
+ auth: {
+ username: 'mikeymike',
+ password: 'rapunz3l'
+ }
+ },
+
+ // `cancelToken` specifies a cancel token that can be used to cancel the request
+ // (see Cancellation section below for details)
+ cancelToken: new CancelToken(function (cancel) {
+ }),
+
+ // `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
+ // - Node only (XHR cannot turn off decompression)
+ decompress: true // default
+
+}
+```
+
+## Response Schema
+
+The response for a request contains the following information.
+
+```js
+{
+ // `data` is the response that was provided by the server
+ data: {},
+
+ // `status` is the HTTP status code from the server response
+ status: 200,
+
+ // `statusText` is the HTTP status message from the server response
+ statusText: 'OK',
+
+ // `headers` the HTTP headers that the server responded with
+ // All header names are lower cased and can be accessed using the bracket notation.
+ // Example: `response.headers['content-type']`
+ headers: {},
+
+ // `config` is the config that was provided to `axios` for the request
+ config: {},
+
+ // `request` is the request that generated this response
+ // It is the last ClientRequest instance in node.js (in redirects)
+ // and an XMLHttpRequest instance in the browser
+ request: {}
+}
+```
+
+When using `then`, you will receive the response as follows:
+
+```js
+axios.get('/user/12345')
+ .then(function (response) {
+ console.log(response.data);
+ console.log(response.status);
+ console.log(response.statusText);
+ console.log(response.headers);
+ console.log(response.config);
+ });
+```
+
+When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
+
+## Config Defaults
+
+You can specify config defaults that will be applied to every request.
+
+### Global axios defaults
+
+```js
+axios.defaults.baseURL = 'https://api.example.com';
+axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
+axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
+```
+
+### Custom instance defaults
+
+```js
+// Set config defaults when creating the instance
+const instance = axios.create({
+ baseURL: 'https://api.example.com'
+});
+
+// Alter defaults after instance has been created
+instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
+```
+
+### Config order of precedence
+
+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.
+
+```js
+// Create an instance using the config defaults provided by the library
+// At this point the timeout config value is `0` as is the default for the library
+const instance = axios.create();
+
+// Override timeout default for the library
+// Now all requests using this instance will wait 2.5 seconds before timing out
+instance.defaults.timeout = 2500;
+
+// Override timeout for this request as it's known to take a long time
+instance.get('/longRequest', {
+ timeout: 5000
+});
+```
+
+## Interceptors
+
+You can intercept requests or responses before they are handled by `then` or `catch`.
+
+```js
+// Add a request interceptor
+axios.interceptors.request.use(function (config) {
+ // Do something before request is sent
+ return config;
+ }, function (error) {
+ // Do something with request error
+ return Promise.reject(error);
+ });
+
+// Add a response interceptor
+axios.interceptors.response.use(function (response) {
+ // Any status code that lie within the range of 2xx cause this function to trigger
+ // Do something with response data
+ return response;
+ }, function (error) {
+ // Any status codes that falls outside the range of 2xx cause this function to trigger
+ // Do something with response error
+ return Promise.reject(error);
+ });
+```
+
+If you need to remove an interceptor later you can.
+
+```js
+const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
+axios.interceptors.request.eject(myInterceptor);
+```
+
+You can add interceptors to a custom instance of axios.
+
+```js
+const instance = axios.create();
+instance.interceptors.request.use(function () {/*...*/});
+```
+
+## Handling Errors
+
+```js
+axios.get('/user/12345')
+ .catch(function (error) {
+ if (error.response) {
+ // The request was made and the server responded with a status code
+ // that falls out of the range of 2xx
+ console.log(error.response.data);
+ console.log(error.response.status);
+ console.log(error.response.headers);
+ } else if (error.request) {
+ // The request was made but no response was received
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
+ // http.ClientRequest in node.js
+ console.log(error.request);
+ } else {
+ // Something happened in setting up the request that triggered an Error
+ console.log('Error', error.message);
+ }
+ console.log(error.config);
+ });
+```
+
+Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
+
+```js
+axios.get('/user/12345', {
+ validateStatus: function (status) {
+ return status < 500; // Resolve only if the status code is less than 500
+ }
+})
+```
+
+Using `toJSON` you get an object with more information about the HTTP error.
+
+```js
+axios.get('/user/12345')
+ .catch(function (error) {
+ console.log(error.toJSON());
+ });
+```
+
+## Cancellation
+
+You can cancel a request using a *cancel token*.
+
+> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
+
+You can create a cancel token using the `CancelToken.source` factory as shown below:
+
+```js
+const CancelToken = axios.CancelToken;
+const source = CancelToken.source();
+
+axios.get('/user/12345', {
+ cancelToken: source.token
+}).catch(function (thrown) {
+ if (axios.isCancel(thrown)) {
+ console.log('Request canceled', thrown.message);
+ } else {
+ // handle error
+ }
+});
+
+axios.post('/user/12345', {
+ name: 'new name'
+}, {
+ cancelToken: source.token
+})
+
+// cancel the request (the message parameter is optional)
+source.cancel('Operation canceled by the user.');
+```
+
+You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
+
+```js
+const CancelToken = axios.CancelToken;
+let cancel;
+
+axios.get('/user/12345', {
+ cancelToken: new CancelToken(function executor(c) {
+ // An executor function receives a cancel function as a parameter
+ cancel = c;
+ })
+});
+
+// cancel the request
+cancel();
+```
+
+> Note: you can cancel several requests with the same cancel token.
+
+## 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.
+
+### Browser
+
+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');
+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).
+
+Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
+
+```js
+const qs = require('qs');
+axios.post('/foo', qs.stringify({ 'bar': 123 }));
+```
+
+Or in another way (ES6),
+
+```js
+import qs from 'qs';
+const data = { 'bar': 123 };
+const options = {
+ method: 'POST',
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
+ data: qs.stringify(data),
+ url,
+};
+axios(options);
+```
+
+### Node.js
+
+#### Query string
+
+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' }));
+```
+
+or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:
+
+```js
+const url = require('url');
+const params = new url.URLSearchParams({ foo: 'bar' });
+axios.post('http://something.com/', params.toString());
+```
+
+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 with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
+
+#### Form data
+
+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, { headers: form.getHeaders() })
+```
+
+Alternatively, use an interceptor:
+
+```js
+axios.interceptors.request.use(config => {
+ if (config.data instanceof FormData) {
+ Object.assign(config.headers, config.data.getHeaders());
+ }
+ return config;
+});
+```
+
+## Semver
+
+Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
+
+## Promises
+
+axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
+If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
+
+## TypeScript
+axios includes [TypeScript](http://typescriptlang.org) definitions.
+```typescript
+import axios from 'axios';
+axios.get('/user?ID=12345');
+```
+
+## Resources
+
+* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
+* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
+* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
+* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
+* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
+
+## Credits
+
+axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
+
+## License
+
+[MIT](LICENSE)
diff --git a/UPGRADE_GUIDE.md b/UPGRADE_GUIDE.md
new file mode 100644
index 0000000..745e804
--- /dev/null
+++ b/UPGRADE_GUIDE.md
@@ -0,0 +1,162 @@
+# Upgrade Guide
+
+### 0.15.x -> 0.16.0
+
+#### `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
+
+#### TypeScript Definitions
+
+The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
+
+Please use the following `import` statement to import axios in TypeScript:
+
+```typescript
+import axios from 'axios';
+
+axios.get('/foo')
+ .then(response => console.log(response))
+ .catch(error => console.log(error));
+```
+
+#### `agent` Config Option
+
+The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
+
+```js
+{
+ // Define a custom agent for HTTP
+ httpAgent: new http.Agent({ keepAlive: true }),
+ // Define a custom agent for HTTPS
+ httpsAgent: new https.Agent({ keepAlive: true })
+}
+```
+
+#### `progress` Config Option
+
+The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
+
+```js
+{
+ // Define a handler for upload progress events
+ onUploadProgress: function (progressEvent) {
+ // ...
+ },
+
+ // Define a handler for download progress events
+ onDownloadProgress: function (progressEvent) {
+ // ...
+ }
+}
+```
+
+### 0.12.x -> 0.13.0
+
+The `0.13.0` release contains several changes to custom adapters and error handling.
+
+#### Error Handling
+
+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.
+
+```js
+axios.get('/user/12345')
+ .catch((error) => {
+ console.log(error.message);
+ console.log(error.code); // Not always specified
+ console.log(error.config); // The config that was used to make the request
+ console.log(error.response); // Only available if response was received from the server
+ });
+```
+
+#### Request Adapters
+
+This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
+
+1. Response transformer is now called outside of adapter.
+2. Request adapter returns a `Promise`.
+
+This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
+
+Previous code:
+
+```js
+function myAdapter(resolve, reject, config) {
+ var response = {
+ data: transformData(
+ responseData,
+ responseHeaders,
+ config.transformResponse
+ ),
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders
+ };
+ settle(resolve, reject, response);
+}
+```
+
+New code:
+
+```js
+function myAdapter(config) {
+ return new Promise(function (resolve, reject) {
+ var response = {
+ data: responseData,
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders
+ };
+ settle(resolve, reject, response);
+ });
+}
+```
+
+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
+
+The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
+
+#### ES6 Promise Polyfill
+
+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.
+
+```js
+require('es6-promise').polyfill();
+var axios = require('axios');
+```
+
+This will polyfill the global environment, and only needs to be done once.
+
+#### `axios.success`/`axios.error`
+
+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.
+
+```js
+axios.get('some/url')
+ .then(function (res) {
+ /* ... */
+ })
+ .catch(function (err) {
+ /* ... */
+ });
+```
+
+#### UMD
+
+Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
+
+```js
+// AMD
+require(['bower_components/axios/dist/axios'], function (axios) {
+ /* ... */
+});
+
+// CommonJS
+var axios = require('axios/dist/axios');
+```
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..cdf037c
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,38 @@
+{
+ "name": "axios",
+ "main": "./dist/axios.js",
+ "version": "0.21.1",
+ "homepage": "https://github.com/axios/axios",
+ "authors": [
+ "Matt Zabriskie"
+ ],
+ "description": "Promise based HTTP client for the browser and node.js",
+ "moduleType": [
+ "amd",
+ "globals"
+ ],
+ "keywords": [
+ "xhr",
+ "http",
+ "ajax",
+ "promise",
+ "node"
+ ],
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "*.iml",
+ "examples",
+ "lib",
+ "node_modules",
+ "sandbox",
+ "test",
+ "CONTRIBUTING.md",
+ "COOKBOOK.md",
+ "Gruntfile.js",
+ "index.js",
+ "karma.conf.js",
+ "package.json",
+ "webpack.*.js"
+ ]
+} \ No newline at end of file
diff --git a/dist/axios.js b/dist/axios.js
new file mode 100644
index 0000000..6dd94bd
--- /dev/null
+++ b/dist/axios.js
@@ -0,0 +1,1756 @@
+/* axios v0.21.1 | (c) 2020 by Matt Zabriskie */
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+ else if(typeof exports === 'object')
+ exports["axios"] = factory();
+ else
+ root["axios"] = factory();
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+/******/
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ module.exports = __webpack_require__(1);
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+ var bind = __webpack_require__(3);
+ var Axios = __webpack_require__(4);
+ var mergeConfig = __webpack_require__(22);
+ var defaults = __webpack_require__(10);
+
+ /**
+ * Create an instance of Axios
+ *
+ * @param {Object} defaultConfig The default config for the instance
+ * @return {Axios} A new instance of Axios
+ */
+ function createInstance(defaultConfig) {
+ var context = new Axios(defaultConfig);
+ var instance = bind(Axios.prototype.request, context);
+
+ // Copy axios.prototype to instance
+ utils.extend(instance, Axios.prototype, context);
+
+ // Copy context to instance
+ utils.extend(instance, context);
+
+ return instance;
+ }
+
+ // Create the default instance to be exported
+ var axios = createInstance(defaults);
+
+ // Expose Axios class to allow class inheritance
+ axios.Axios = Axios;
+
+ // Factory for creating new instances
+ axios.create = function create(instanceConfig) {
+ return createInstance(mergeConfig(axios.defaults, instanceConfig));
+ };
+
+ // Expose Cancel & CancelToken
+ axios.Cancel = __webpack_require__(23);
+ axios.CancelToken = __webpack_require__(24);
+ axios.isCancel = __webpack_require__(9);
+
+ // Expose all/spread
+ axios.all = function all(promises) {
+ return Promise.all(promises);
+ };
+ axios.spread = __webpack_require__(25);
+
+ // Expose isAxiosError
+ axios.isAxiosError = __webpack_require__(26);
+
+ module.exports = axios;
+
+ // Allow use of default import syntax in TypeScript
+ module.exports.default = axios;
+
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var bind = __webpack_require__(3);
+
+ /*global toString:true*/
+
+ // utils is a library of generic helper functions non-specific to axios
+
+ var toString = Object.prototype.toString;
+
+ /**
+ * Determine if a value is an Array
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Array, otherwise false
+ */
+ function isArray(val) {
+ return toString.call(val) === '[object Array]';
+ }
+
+ /**
+ * Determine if a value is undefined
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if the value is undefined, otherwise false
+ */
+ function isUndefined(val) {
+ return typeof val === 'undefined';
+ }
+
+ /**
+ * Determine if a value is a Buffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Buffer, otherwise false
+ */
+ function isBuffer(val) {
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
+ }
+
+ /**
+ * Determine if a value is an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
+ */
+ function isArrayBuffer(val) {
+ return toString.call(val) === '[object ArrayBuffer]';
+ }
+
+ /**
+ * Determine if a value is a FormData
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an FormData, otherwise false
+ */
+ function isFormData(val) {
+ return (typeof FormData !== 'undefined') && (val instanceof FormData);
+ }
+
+ /**
+ * Determine if a value is a view on an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
+ */
+ function isArrayBufferView(val) {
+ var result;
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
+ result = ArrayBuffer.isView(val);
+ } else {
+ result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
+ }
+ return result;
+ }
+
+ /**
+ * Determine if a value is a String
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a String, otherwise false
+ */
+ function isString(val) {
+ return typeof val === 'string';
+ }
+
+ /**
+ * Determine if a value is a Number
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Number, otherwise false
+ */
+ function isNumber(val) {
+ return typeof val === 'number';
+ }
+
+ /**
+ * Determine if a value is an Object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Object, otherwise false
+ */
+ function isObject(val) {
+ return val !== null && typeof val === 'object';
+ }
+
+ /**
+ * Determine if a value is a plain Object
+ *
+ * @param {Object} val The value to test
+ * @return {boolean} True if value is a plain Object, otherwise false
+ */
+ function isPlainObject(val) {
+ if (toString.call(val) !== '[object Object]') {
+ return false;
+ }
+
+ var prototype = Object.getPrototypeOf(val);
+ return prototype === null || prototype === Object.prototype;
+ }
+
+ /**
+ * Determine if a value is a Date
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Date, otherwise false
+ */
+ function isDate(val) {
+ return toString.call(val) === '[object Date]';
+ }
+
+ /**
+ * Determine if a value is a File
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a File, otherwise false
+ */
+ function isFile(val) {
+ return toString.call(val) === '[object File]';
+ }
+
+ /**
+ * Determine if a value is a Blob
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Blob, otherwise false
+ */
+ function isBlob(val) {
+ return toString.call(val) === '[object Blob]';
+ }
+
+ /**
+ * Determine if a value is a Function
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Function, otherwise false
+ */
+ function isFunction(val) {
+ return toString.call(val) === '[object Function]';
+ }
+
+ /**
+ * Determine if a value is a Stream
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Stream, otherwise false
+ */
+ function isStream(val) {
+ return isObject(val) && isFunction(val.pipe);
+ }
+
+ /**
+ * Determine if a value is a URLSearchParams object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
+ */
+ function isURLSearchParams(val) {
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
+ }
+
+ /**
+ * Trim excess whitespace off the beginning and end of a string
+ *
+ * @param {String} str The String to trim
+ * @returns {String} The String freed of excess whitespace
+ */
+ function trim(str) {
+ return str.replace(/^\s*/, '').replace(/\s*$/, '');
+ }
+
+ /**
+ * Determine if we're running in a standard browser environment
+ *
+ * This allows axios to run in a web worker, and react-native.
+ * Both environments support XMLHttpRequest, but not fully standard globals.
+ *
+ * web workers:
+ * typeof window -> undefined
+ * typeof document -> undefined
+ *
+ * react-native:
+ * navigator.product -> 'ReactNative'
+ * nativescript
+ * navigator.product -> 'NativeScript' or 'NS'
+ */
+ function isStandardBrowserEnv() {
+ if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
+ navigator.product === 'NativeScript' ||
+ navigator.product === 'NS')) {
+ return false;
+ }
+ return (
+ typeof window !== 'undefined' &&
+ typeof document !== 'undefined'
+ );
+ }
+
+ /**
+ * Iterate over an Array or an Object invoking a function for each item.
+ *
+ * If `obj` is an Array callback will be called passing
+ * the value, index, and complete array for each item.
+ *
+ * If 'obj' is an Object callback will be called passing
+ * the value, key, and complete object for each property.
+ *
+ * @param {Object|Array} obj The object to iterate
+ * @param {Function} fn The callback to invoke for each item
+ */
+ function forEach(obj, fn) {
+ // Don't bother if no value provided
+ if (obj === null || typeof obj === 'undefined') {
+ return;
+ }
+
+ // Force an array if not already something iterable
+ if (typeof obj !== 'object') {
+ /*eslint no-param-reassign:0*/
+ obj = [obj];
+ }
+
+ if (isArray(obj)) {
+ // Iterate over array values
+ for (var i = 0, l = obj.length; i < l; i++) {
+ fn.call(null, obj[i], i, obj);
+ }
+ } else {
+ // Iterate over object keys
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ fn.call(null, obj[key], key, obj);
+ }
+ }
+ }
+ }
+
+ /**
+ * Accepts varargs expecting each argument to be an object, then
+ * immutably merges the properties of each object and returns result.
+ *
+ * When multiple objects contain the same key the later object in
+ * the arguments list will take precedence.
+ *
+ * Example:
+ *
+ * ```js
+ * var result = merge({foo: 123}, {foo: 456});
+ * console.log(result.foo); // outputs 456
+ * ```
+ *
+ * @param {Object} obj1 Object to merge
+ * @returns {Object} Result of all merge properties
+ */
+ function merge(/* obj1, obj2, obj3, ... */) {
+ var result = {};
+ function assignValue(val, key) {
+ if (isPlainObject(result[key]) && isPlainObject(val)) {
+ result[key] = merge(result[key], val);
+ } else if (isPlainObject(val)) {
+ result[key] = merge({}, val);
+ } else if (isArray(val)) {
+ result[key] = val.slice();
+ } else {
+ result[key] = val;
+ }
+ }
+
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ forEach(arguments[i], assignValue);
+ }
+ return result;
+ }
+
+ /**
+ * Extends object a by mutably adding to it the properties of object b.
+ *
+ * @param {Object} a The object to be extended
+ * @param {Object} b The object to copy properties from
+ * @param {Object} thisArg The object to bind function to
+ * @return {Object} The resulting value of object a
+ */
+ function extend(a, b, thisArg) {
+ forEach(b, function assignValue(val, key) {
+ if (thisArg && typeof val === 'function') {
+ a[key] = bind(val, thisArg);
+ } else {
+ a[key] = val;
+ }
+ });
+ return a;
+ }
+
+ /**
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
+ *
+ * @param {string} content with BOM
+ * @return {string} content value without BOM
+ */
+ function stripBOM(content) {
+ if (content.charCodeAt(0) === 0xFEFF) {
+ content = content.slice(1);
+ }
+ return content;
+ }
+
+ module.exports = {
+ isArray: isArray,
+ isArrayBuffer: isArrayBuffer,
+ isBuffer: isBuffer,
+ isFormData: isFormData,
+ isArrayBufferView: isArrayBufferView,
+ isString: isString,
+ isNumber: isNumber,
+ isObject: isObject,
+ isPlainObject: isPlainObject,
+ isUndefined: isUndefined,
+ isDate: isDate,
+ isFile: isFile,
+ isBlob: isBlob,
+ isFunction: isFunction,
+ isStream: isStream,
+ isURLSearchParams: isURLSearchParams,
+ isStandardBrowserEnv: isStandardBrowserEnv,
+ forEach: forEach,
+ merge: merge,
+ extend: extend,
+ trim: trim,
+ stripBOM: stripBOM
+ };
+
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ module.exports = function bind(fn, thisArg) {
+ 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);
+ };
+ };
+
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+ var buildURL = __webpack_require__(5);
+ var InterceptorManager = __webpack_require__(6);
+ var dispatchRequest = __webpack_require__(7);
+ var mergeConfig = __webpack_require__(22);
+
+ /**
+ * Create a new instance of Axios
+ *
+ * @param {Object} instanceConfig The default config for the instance
+ */
+ function Axios(instanceConfig) {
+ this.defaults = instanceConfig;
+ this.interceptors = {
+ request: new InterceptorManager(),
+ response: new InterceptorManager()
+ };
+ }
+
+ /**
+ * Dispatch a request
+ *
+ * @param {Object} config The config specific for this request (merged with this.defaults)
+ */
+ Axios.prototype.request = function request(config) {
+ /*eslint no-param-reassign:0*/
+ // Allow for axios('example/url'[, config]) a la fetch API
+ if (typeof config === 'string') {
+ config = arguments[1] || {};
+ config.url = arguments[0];
+ } else {
+ config = config || {};
+ }
+
+ config = mergeConfig(this.defaults, config);
+
+ // Set config.method
+ if (config.method) {
+ config.method = config.method.toLowerCase();
+ } else if (this.defaults.method) {
+ config.method = this.defaults.method.toLowerCase();
+ } else {
+ config.method = 'get';
+ }
+
+ // Hook up interceptors middleware
+ var chain = [dispatchRequest, undefined];
+ var promise = Promise.resolve(config);
+
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
+ chain.unshift(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
+ chain.push(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ while (chain.length) {
+ promise = promise.then(chain.shift(), chain.shift());
+ }
+
+ return promise;
+ };
+
+ Axios.prototype.getUri = function getUri(config) {
+ config = mergeConfig(this.defaults, config);
+ return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
+ };
+
+ // Provide aliases for supported request methods
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, config) {
+ return this.request(mergeConfig(config || {}, {
+ method: method,
+ url: url,
+ data: (config || {}).data
+ }));
+ };
+ });
+
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, data, config) {
+ return this.request(mergeConfig(config || {}, {
+ method: method,
+ url: url,
+ data: data
+ }));
+ };
+ });
+
+ module.exports = Axios;
+
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ function encode(val) {
+ return encodeURIComponent(val).
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%20/g, '+').
+ replace(/%5B/gi, '[').
+ replace(/%5D/gi, ']');
+ }
+
+ /**
+ * Build a URL by appending params to the end
+ *
+ * @param {string} url The base of the url (e.g., http://www.google.com)
+ * @param {object} [params] The params to be appended
+ * @returns {string} The formatted url
+ */
+ module.exports = function buildURL(url, params, paramsSerializer) {
+ /*eslint no-param-reassign:0*/
+ if (!params) {
+ return url;
+ }
+
+ var serializedParams;
+ if (paramsSerializer) {
+ serializedParams = paramsSerializer(params);
+ } else if (utils.isURLSearchParams(params)) {
+ serializedParams = params.toString();
+ } else {
+ var parts = [];
+
+ utils.forEach(params, function serialize(val, key) {
+ if (val === null || typeof val === 'undefined') {
+ return;
+ }
+
+ if (utils.isArray(val)) {
+ key = key + '[]';
+ } else {
+ val = [val];
+ }
+
+ 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));
+ });
+ });
+
+ serializedParams = parts.join('&');
+ }
+
+ if (serializedParams) {
+ var hashmarkIndex = url.indexOf('#');
+ if (hashmarkIndex !== -1) {
+ url = url.slice(0, hashmarkIndex);
+ }
+
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
+ }
+
+ return url;
+ };
+
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ function InterceptorManager() {
+ this.handlers = [];
+ }
+
+ /**
+ * Add a new interceptor to the stack
+ *
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
+ *
+ * @return {Number} An ID used to remove interceptor later
+ */
+ InterceptorManager.prototype.use = function use(fulfilled, rejected) {
+ this.handlers.push({
+ fulfilled: fulfilled,
+ rejected: rejected
+ });
+ return this.handlers.length - 1;
+ };
+
+ /**
+ * Remove an interceptor from the stack
+ *
+ * @param {Number} id The ID that was returned by `use`
+ */
+ InterceptorManager.prototype.eject = function eject(id) {
+ if (this.handlers[id]) {
+ this.handlers[id] = null;
+ }
+ };
+
+ /**
+ * Iterate over all the registered interceptors
+ *
+ * This method is particularly useful for skipping over any
+ * interceptors that may have become `null` calling `eject`.
+ *
+ * @param {Function} fn The function to call for each interceptor
+ */
+ InterceptorManager.prototype.forEach = function forEach(fn) {
+ utils.forEach(this.handlers, function forEachHandler(h) {
+ if (h !== null) {
+ fn(h);
+ }
+ });
+ };
+
+ module.exports = InterceptorManager;
+
+
+/***/ }),
+/* 7 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+ var transformData = __webpack_require__(8);
+ var isCancel = __webpack_require__(9);
+ var defaults = __webpack_require__(10);
+
+ /**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+ function throwIfCancellationRequested(config) {
+ if (config.cancelToken) {
+ config.cancelToken.throwIfRequested();
+ }
+ }
+
+ /**
+ * Dispatch a request to the server using the configured adapter.
+ *
+ * @param {object} config The config that is to be used for the request
+ * @returns {Promise} The Promise to be fulfilled
+ */
+ module.exports = function dispatchRequest(config) {
+ throwIfCancellationRequested(config);
+
+ // Ensure headers exist
+ config.headers = config.headers || {};
+
+ // Transform request data
+ config.data = transformData(
+ config.data,
+ config.headers,
+ config.transformRequest
+ );
+
+ // Flatten headers
+ config.headers = utils.merge(
+ config.headers.common || {},
+ config.headers[config.method] || {},
+ config.headers
+ );
+
+ utils.forEach(
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
+ function cleanHeaderConfig(method) {
+ delete config.headers[method];
+ }
+ );
+
+ var adapter = config.adapter || defaults.adapter;
+
+ return adapter(config).then(function onAdapterResolution(response) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ response.data = transformData(
+ response.data,
+ response.headers,
+ config.transformResponse
+ );
+
+ return response;
+ }, function onAdapterRejection(reason) {
+ if (!isCancel(reason)) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ if (reason && reason.response) {
+ reason.response.data = transformData(
+ reason.response.data,
+ reason.response.headers,
+ config.transformResponse
+ );
+ }
+ }
+
+ return Promise.reject(reason);
+ });
+ };
+
+
+/***/ }),
+/* 8 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ /**
+ * Transform the data for a request or a response
+ *
+ * @param {Object|String} data The data to be transformed
+ * @param {Array} headers The headers for the request or response
+ * @param {Array|Function} fns A single function or Array of functions
+ * @returns {*} The resulting transformed data
+ */
+ module.exports = function transformData(data, headers, fns) {
+ /*eslint no-param-reassign:0*/
+ utils.forEach(fns, function transform(fn) {
+ data = fn(data, headers);
+ });
+
+ return data;
+ };
+
+
+/***/ }),
+/* 9 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ module.exports = function isCancel(value) {
+ return !!(value && value.__CANCEL__);
+ };
+
+
+/***/ }),
+/* 10 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+ var normalizeHeaderName = __webpack_require__(11);
+
+ var DEFAULT_CONTENT_TYPE = {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ };
+
+ function setContentTypeIfUnset(headers, value) {
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
+ headers['Content-Type'] = value;
+ }
+ }
+
+ function getDefaultAdapter() {
+ var adapter;
+ if (typeof XMLHttpRequest !== 'undefined') {
+ // For browsers use XHR adapter
+ adapter = __webpack_require__(12);
+ } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
+ // For node use HTTP adapter
+ adapter = __webpack_require__(12);
+ }
+ return adapter;
+ }
+
+ var defaults = {
+ adapter: getDefaultAdapter(),
+
+ transformRequest: [function transformRequest(data, headers) {
+ normalizeHeaderName(headers, 'Accept');
+ normalizeHeaderName(headers, 'Content-Type');
+ if (utils.isFormData(data) ||
+ utils.isArrayBuffer(data) ||
+ utils.isBuffer(data) ||
+ utils.isStream(data) ||
+ utils.isFile(data) ||
+ utils.isBlob(data)
+ ) {
+ return data;
+ }
+ if (utils.isArrayBufferView(data)) {
+ return data.buffer;
+ }
+ if (utils.isURLSearchParams(data)) {
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
+ return data.toString();
+ }
+ if (utils.isObject(data)) {
+ setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
+ return JSON.stringify(data);
+ }
+ return data;
+ }],
+
+ transformResponse: [function transformResponse(data) {
+ /*eslint no-param-reassign:0*/
+ if (typeof data === 'string') {
+ try {
+ data = JSON.parse(data);
+ } catch (e) { /* Ignore */ }
+ }
+ return data;
+ }],
+
+ /**
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
+ * timeout is not created.
+ */
+ timeout: 0,
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ maxContentLength: -1,
+ maxBodyLength: -1,
+
+ validateStatus: function validateStatus(status) {
+ return status >= 200 && status < 300;
+ }
+ };
+
+ defaults.headers = {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ }
+ };
+
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
+ defaults.headers[method] = {};
+ });
+
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
+ });
+
+ module.exports = defaults;
+
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ module.exports = function normalizeHeaderName(headers, normalizedName) {
+ utils.forEach(headers, function processHeader(value, name) {
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
+ headers[normalizedName] = value;
+ delete headers[name];
+ }
+ });
+ };
+
+
+/***/ }),
+/* 12 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+ var settle = __webpack_require__(13);
+ var cookies = __webpack_require__(16);
+ var buildURL = __webpack_require__(5);
+ var buildFullPath = __webpack_require__(17);
+ var parseHeaders = __webpack_require__(20);
+ var isURLSameOrigin = __webpack_require__(21);
+ var createError = __webpack_require__(14);
+
+ module.exports = function xhrAdapter(config) {
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
+ var requestData = config.data;
+ var requestHeaders = config.headers;
+
+ if (utils.isFormData(requestData)) {
+ delete requestHeaders['Content-Type']; // Let the browser set it
+ }
+
+ var request = new XMLHttpRequest();
+
+ // HTTP basic authentication
+ if (config.auth) {
+ var username = config.auth.username || '';
+ var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
+ }
+
+ var fullPath = buildFullPath(config.baseURL, config.url);
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
+
+ // Set the request timeout in MS
+ request.timeout = config.timeout;
+
+ // Listen for ready state
+ request.onreadystatechange = function handleLoad() {
+ if (!request || request.readyState !== 4) {
+ return;
+ }
+
+ // The request errored out and we didn't get a response, this will be
+ // handled by onerror instead
+ // With one exception: request that using file: protocol, most browsers
+ // will return status as 0 even though it's a successful request
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
+ return;
+ }
+
+ // Prepare the response
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
+ var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
+ var response = {
+ data: responseData,
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders,
+ config: config,
+ request: request
+ };
+
+ settle(resolve, reject, response);
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle browser request cancellation (as opposed to a manual cancellation)
+ request.onabort = function handleAbort() {
+ if (!request) {
+ return;
+ }
+
+ reject(createError('Request aborted', config, 'ECONNABORTED', request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle low level network errors
+ request.onerror = function handleError() {
+ // Real errors are hidden from us by the browser
+ // onerror should only fire if it's a network error
+ reject(createError('Network Error', config, null, request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle timeout
+ request.ontimeout = function handleTimeout() {
+ var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
+ if (config.timeoutErrorMessage) {
+ timeoutErrorMessage = config.timeoutErrorMessage;
+ }
+ reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
+ request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Add xsrf header
+ // This is only done if running in a standard browser environment.
+ // Specifically not if we're in a web worker, or react-native.
+ if (utils.isStandardBrowserEnv()) {
+ // Add xsrf header
+ var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
+ cookies.read(config.xsrfCookieName) :
+ undefined;
+
+ if (xsrfValue) {
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
+ }
+ }
+
+ // Add headers to the request
+ if ('setRequestHeader' in request) {
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
+ // Remove Content-Type if data is undefined
+ delete requestHeaders[key];
+ } else {
+ // Otherwise add header to the request
+ request.setRequestHeader(key, val);
+ }
+ });
+ }
+
+ // Add withCredentials to request if needed
+ if (!utils.isUndefined(config.withCredentials)) {
+ request.withCredentials = !!config.withCredentials;
+ }
+
+ // Add responseType to request if needed
+ if (config.responseType) {
+ try {
+ request.responseType = config.responseType;
+ } catch (e) {
+ // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
+ // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
+ if (config.responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ // Handle progress if needed
+ if (typeof config.onDownloadProgress === 'function') {
+ request.addEventListener('progress', config.onDownloadProgress);
+ }
+
+ // Not all browsers support upload events
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
+ request.upload.addEventListener('progress', config.onUploadProgress);
+ }
+
+ if (config.cancelToken) {
+ // Handle cancellation
+ config.cancelToken.promise.then(function onCanceled(cancel) {
+ if (!request) {
+ return;
+ }
+
+ request.abort();
+ reject(cancel);
+ // Clean up request
+ request = null;
+ });
+ }
+
+ if (!requestData) {
+ requestData = null;
+ }
+
+ // Send the request
+ request.send(requestData);
+ });
+ };
+
+
+/***/ }),
+/* 13 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var createError = __webpack_require__(14);
+
+ /**
+ * Resolve or reject a Promise based on response status.
+ *
+ * @param {Function} resolve A function that resolves the promise.
+ * @param {Function} reject A function that rejects the promise.
+ * @param {object} response The response.
+ */
+ module.exports = function settle(resolve, reject, response) {
+ var validateStatus = response.config.validateStatus;
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
+ resolve(response);
+ } else {
+ reject(createError(
+ 'Request failed with status code ' + response.status,
+ response.config,
+ null,
+ response.request,
+ response
+ ));
+ }
+ };
+
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var enhanceError = __webpack_require__(15);
+
+ /**
+ * Create an Error with the specified message, config, error code, request and response.
+ *
+ * @param {string} message The error message.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The created error.
+ */
+ module.exports = function createError(message, config, code, request, response) {
+ var error = new Error(message);
+ return enhanceError(error, config, code, request, response);
+ };
+
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Update an Error with the specified config, error code, and response.
+ *
+ * @param {Error} error The error to update.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The error.
+ */
+ module.exports = function enhanceError(error, config, code, request, response) {
+ error.config = config;
+ if (code) {
+ error.code = code;
+ }
+
+ error.request = request;
+ error.response = response;
+ error.isAxiosError = true;
+
+ error.toJSON = function toJSON() {
+ return {
+ // Standard
+ message: this.message,
+ name: this.name,
+ // Microsoft
+ description: this.description,
+ number: this.number,
+ // Mozilla
+ fileName: this.fileName,
+ lineNumber: this.lineNumber,
+ columnNumber: this.columnNumber,
+ stack: this.stack,
+ // Axios
+ config: this.config,
+ code: this.code
+ };
+ };
+ return error;
+ };
+
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs support document.cookie
+ (function standardBrowserEnv() {
+ return {
+ write: function write(name, value, expires, path, domain, secure) {
+ var cookie = [];
+ cookie.push(name + '=' + encodeURIComponent(value));
+
+ if (utils.isNumber(expires)) {
+ cookie.push('expires=' + new Date(expires).toGMTString());
+ }
+
+ if (utils.isString(path)) {
+ cookie.push('path=' + path);
+ }
+
+ if (utils.isString(domain)) {
+ cookie.push('domain=' + domain);
+ }
+
+ if (secure === true) {
+ cookie.push('secure');
+ }
+
+ document.cookie = cookie.join('; ');
+ },
+
+ read: function read(name) {
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
+ return (match ? decodeURIComponent(match[3]) : null);
+ },
+
+ remove: function remove(name) {
+ this.write(name, '', Date.now() - 86400000);
+ }
+ };
+ })() :
+
+ // Non standard browser env (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return {
+ write: function write() {},
+ read: function read() { return null; },
+ remove: function remove() {}
+ };
+ })()
+ );
+
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var isAbsoluteURL = __webpack_require__(18);
+ var combineURLs = __webpack_require__(19);
+
+ /**
+ * Creates a new URL by combining the baseURL with the requestedURL,
+ * only when the requestedURL is not already an absolute URL.
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} requestedURL Absolute or relative URL to combine
+ * @returns {string} The combined full path
+ */
+ module.exports = function buildFullPath(baseURL, requestedURL) {
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
+ return combineURLs(baseURL, requestedURL);
+ }
+ return requestedURL;
+ };
+
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Determines whether the specified URL is absolute
+ *
+ * @param {string} url The URL to test
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
+ */
+ module.exports = function isAbsoluteURL(url) {
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
+ // by any combination of letters, digits, plus, period, or hyphen.
+ return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
+ };
+
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Creates a new URL by combining the specified URLs
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} relativeURL The relative URL
+ * @returns {string} The combined URL
+ */
+ module.exports = function combineURLs(baseURL, relativeURL) {
+ return relativeURL
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
+ : baseURL;
+ };
+
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ // Headers whose duplicates are ignored by node
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
+ var ignoreDuplicateOf = [
+ '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'
+ ];
+
+ /**
+ * Parse headers into an object
+ *
+ * ```
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
+ * Content-Type: application/json
+ * Connection: keep-alive
+ * Transfer-Encoding: chunked
+ * ```
+ *
+ * @param {String} headers Headers needing to be parsed
+ * @returns {Object} Headers parsed into an object
+ */
+ module.exports = function parseHeaders(headers) {
+ var parsed = {};
+ var key;
+ var val;
+ var i;
+
+ if (!headers) { return parsed; }
+
+ utils.forEach(headers.split('\n'), function parser(line) {
+ i = line.indexOf(':');
+ key = utils.trim(line.substr(0, i)).toLowerCase();
+ val = utils.trim(line.substr(i + 1));
+
+ if (key) {
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
+ return;
+ }
+ if (key === 'set-cookie') {
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
+ } else {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+ });
+
+ return parsed;
+ };
+
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs have full support of the APIs needed to test
+ // whether the request URL is of the same origin as current location.
+ (function standardBrowserEnv() {
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
+ var urlParsingNode = document.createElement('a');
+ var originURL;
+
+ /**
+ * Parse a URL to discover it's components
+ *
+ * @param {String} url The URL to be parsed
+ * @returns {Object}
+ */
+ function resolveURL(url) {
+ var href = url;
+
+ if (msie) {
+ // IE needs attribute set twice to normalize properties
+ urlParsingNode.setAttribute('href', href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
+ urlParsingNode.pathname :
+ '/' + urlParsingNode.pathname
+ };
+ }
+
+ originURL = resolveURL(window.location.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
+ */
+ return function isURLSameOrigin(requestURL) {
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
+ return (parsed.protocol === originURL.protocol &&
+ parsed.host === originURL.host);
+ };
+ })() :
+
+ // Non standard browser envs (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return function isURLSameOrigin() {
+ return true;
+ };
+ })()
+ );
+
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var utils = __webpack_require__(2);
+
+ /**
+ * Config-specific merge-function which creates a new config-object
+ * by merging two configuration objects together.
+ *
+ * @param {Object} config1
+ * @param {Object} config2
+ * @returns {Object} New object resulting from merging config2 to config1
+ */
+ module.exports = function mergeConfig(config1, config2) {
+ // eslint-disable-next-line no-param-reassign
+ config2 = config2 || {};
+ var config = {};
+
+ var valueFromConfig2Keys = ['url', 'method', 'data'];
+ var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
+ var defaultToConfig2Keys = [
+ 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
+ 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
+ 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
+ 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
+ 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
+ ];
+ var directMergeKeys = ['validateStatus'];
+
+ function getMergedValue(target, source) {
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
+ return utils.merge(target, source);
+ } else if (utils.isPlainObject(source)) {
+ return utils.merge({}, source);
+ } else if (utils.isArray(source)) {
+ return source.slice();
+ }
+ return source;
+ }
+
+ function mergeDeepProperties(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(config1[prop], config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ }
+
+ utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(undefined, config2[prop]);
+ }
+ });
+
+ utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
+
+ utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(undefined, config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ });
+
+ utils.forEach(directMergeKeys, function merge(prop) {
+ if (prop in config2) {
+ config[prop] = getMergedValue(config1[prop], config2[prop]);
+ } else if (prop in config1) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ });
+
+ var axiosKeys = valueFromConfig2Keys
+ .concat(mergeDeepPropertiesKeys)
+ .concat(defaultToConfig2Keys)
+ .concat(directMergeKeys);
+
+ var otherKeys = Object
+ .keys(config1)
+ .concat(Object.keys(config2))
+ .filter(function filterAxiosKeys(key) {
+ return axiosKeys.indexOf(key) === -1;
+ });
+
+ utils.forEach(otherKeys, mergeDeepProperties);
+
+ return config;
+ };
+
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * A `Cancel` is an object that is thrown when an operation is canceled.
+ *
+ * @class
+ * @param {string=} message The message.
+ */
+ function Cancel(message) {
+ this.message = message;
+ }
+
+ Cancel.prototype.toString = function toString() {
+ return 'Cancel' + (this.message ? ': ' + this.message : '');
+ };
+
+ Cancel.prototype.__CANCEL__ = true;
+
+ module.exports = Cancel;
+
+
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Cancel = __webpack_require__(23);
+
+ /**
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
+ *
+ * @class
+ * @param {Function} executor The executor function.
+ */
+ function CancelToken(executor) {
+ if (typeof executor !== 'function') {
+ throw new TypeError('executor must be a function.');
+ }
+
+ var resolvePromise;
+ this.promise = new Promise(function promiseExecutor(resolve) {
+ resolvePromise = resolve;
+ });
+
+ var token = this;
+ executor(function cancel(message) {
+ if (token.reason) {
+ // Cancellation has already been requested
+ return;
+ }
+
+ token.reason = new Cancel(message);
+ resolvePromise(token.reason);
+ });
+ }
+
+ /**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
+ if (this.reason) {
+ throw this.reason;
+ }
+ };
+
+ /**
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
+ * cancels the `CancelToken`.
+ */
+ CancelToken.source = function source() {
+ var cancel;
+ var token = new CancelToken(function executor(c) {
+ cancel = c;
+ });
+ return {
+ token: token,
+ cancel: cancel
+ };
+ };
+
+ module.exports = CancelToken;
+
+
+/***/ }),
+/* 25 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
+ *
+ * Common use case would be to use `Function.prototype.apply`.
+ *
+ * ```js
+ * function f(x, y, z) {}
+ * var args = [1, 2, 3];
+ * f.apply(null, args);
+ * ```
+ *
+ * With `spread` this example can be re-written.
+ *
+ * ```js
+ * spread(function(x, y, z) {})([1, 2, 3]);
+ * ```
+ *
+ * @param {Function} callback
+ * @returns {Function}
+ */
+ module.exports = function spread(callback) {
+ return function wrap(arr) {
+ return callback.apply(null, arr);
+ };
+ };
+
+
+/***/ }),
+/* 26 */
+/***/ (function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Determines whether the payload is an error thrown by Axios
+ *
+ * @param {*} payload The value to test
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
+ */
+ module.exports = function isAxiosError(payload) {
+ return (typeof payload === 'object') && (payload.isAxiosError === true);
+ };
+
+
+/***/ })
+/******/ ])
+});
+;
+//# sourceMappingURL=axios.map \ No newline at end of file
diff --git a/dist/axios.map b/dist/axios.map
new file mode 100644
index 0000000..6d61f7e
--- /dev/null
+++ b/dist/axios.map
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 0ad9e9f79033ec4fb28f","webpack:///./index.js","webpack:///./lib/axios.js","webpack:///./lib/utils.js","webpack:///./lib/helpers/bind.js","webpack:///./lib/core/Axios.js","webpack:///./lib/helpers/buildURL.js","webpack:///./lib/core/InterceptorManager.js","webpack:///./lib/core/dispatchRequest.js","webpack:///./lib/core/transformData.js","webpack:///./lib/cancel/isCancel.js","webpack:///./lib/defaults.js","webpack:///./lib/helpers/normalizeHeaderName.js","webpack:///./lib/adapters/xhr.js","webpack:///./lib/core/settle.js","webpack:///./lib/core/createError.js","webpack:///./lib/core/enhanceError.js","webpack:///./lib/helpers/cookies.js","webpack:///./lib/core/buildFullPath.js","webpack:///./lib/helpers/isAbsoluteURL.js","webpack:///./lib/helpers/combineURLs.js","webpack:///./lib/helpers/parseHeaders.js","webpack:///./lib/helpers/isURLSameOrigin.js","webpack:///./lib/core/mergeConfig.js","webpack:///./lib/cancel/Cancel.js","webpack:///./lib/cancel/CancelToken.js","webpack:///./lib/helpers/spread.js","webpack:///./lib/helpers/isAxiosError.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA,yC;;;;;;ACAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;;;;;;ACvDA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA2B;AAC3B;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,6BAA4B;AAC5B,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC9VA;;AAEA;AACA;AACA;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA,0BAAyB;AACzB,MAAK;AACL;AACA,EAAC;;AAED;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;;;;;;;AC9FA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACrEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAA+B;AAC/B,wCAAuC;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;;;;;;;AC9EA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,MAAM;AACjB,YAAW,eAAe;AAC1B,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE;AACxE;AACA;AACA;AACA,wDAAuD;AACvD;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,QAAO,YAAY;AACnB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA,EAAC;;AAED;;;;;;;ACjGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACXA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6CAA4C;AAC5C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;;;;;;AClLA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxBA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;;;;;;ACjBA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzCA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2CAA0C;AAC1C,UAAS;;AAET;AACA,6DAA4D,wBAAwB;AACpF;AACA,UAAS;;AAET;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,mCAAkC;AAClC,gCAA+B,aAAa,EAAE;AAC9C;AACA;AACA,MAAK;AACL;;;;;;;ACpDA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,eAAe;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACpDA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;;;;;;ACnEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL,4BAA2B;AAC3B,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;;AAEA;AACA;;;;;;;ACtFA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,YAAW,SAAS;AACpB,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA","file":"axios.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0ad9e9f79033ec4fb28f","module.exports = require('./lib/axios');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/axios.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/bind.js\n// module id = 3\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/Axios.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/buildURL.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/InterceptorManager.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/dispatchRequest.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/transformData.js\n// module id = 8\n// module chunks = 0","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/isCancel.js\n// module id = 9\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/normalizeHeaderName.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/adapters/xhr.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/settle.js\n// module id = 13\n// module chunks = 0","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/createError.js\n// module id = 14\n// module chunks = 0","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/enhanceError.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/cookies.js\n// module id = 16\n// module chunks = 0","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/buildFullPath.js\n// module id = 17\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAbsoluteURL.js\n// module id = 18\n// module chunks = 0","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/combineURLs.js\n// module id = 19\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/parseHeaders.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isURLSameOrigin.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/mergeConfig.js\n// module id = 22\n// module chunks = 0","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/Cancel.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/CancelToken.js\n// module id = 24\n// module chunks = 0","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/spread.js\n// module id = 25\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAxiosError.js\n// module id = 26\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file
diff --git a/dist/axios.min.js b/dist/axios.min.js
new file mode 100644
index 0000000..fc6c8b6
--- /dev/null
+++ b/dist/axios.min.js
@@ -0,0 +1,3 @@
+/* axios v0.21.1 | (c) 2020 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){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=s(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(2),s=n(3),i=n(4),a=n(22),u=n(10),c=r(u);c.Axios=i,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(9),c.all=function(e){return Promise.all(e)},c.spread=n(25),c.isAxiosError=n(26),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"undefined"==typeof e}function s(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function i(e){return"[object ArrayBuffer]"===R.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function u(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function c(e){return"string"==typeof e}function f(e){return"number"==typeof e}function p(e){return null!==e&&"object"==typeof e}function d(e){if("[object Object]"!==R.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Date]"===R.call(e)}function h(e){return"[object File]"===R.call(e)}function m(e){return"[object Blob]"===R.call(e)}function y(e){return"[object Function]"===R.call(e)}function g(e){return p(e)&&y(e.pipe)}function v(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function x(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function w(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}function E(){function e(e,n){d(t[n])&&d(e)?t[n]=E(t[n],e):d(e)?t[n]=E({},e):r(e)?t[n]=e.slice():t[n]=e}for(var t={},n=0,o=arguments.length;n<o;n++)b(arguments[n],e);return t}function j(e,t,n){return b(t,function(t,r){n&&"function"==typeof t?e[r]=S(t,n):e[r]=t}),e}function C(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}var S=n(3),R=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:i,isBuffer:s,isFormData:a,isArrayBufferView:u,isString:c,isNumber:f,isObject:p,isPlainObject:d,isUndefined:o,isDate:l,isFile:h,isBlob:m,isFunction:y,isStream:g,isURLSearchParams:v,isStandardBrowserEnv:w,forEach:b,merge:E,extend:j,trim:x,stripBOM:C}},function(e,t){"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";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(2),s=n(5),i=n(6),a=n(7),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=u(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(u(n||{},{method:e,url:t,data:(n||{}).data}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(u(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(r(t)+"="+r(e))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),s=n(8),i=n(9),a=n(10);e.exports=function(e){r(e),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return r(e),t.data=s(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";function r(e,t){!s.isUndefined(e)&&s.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(12):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=n(12)),e}var s=n(2),i=n(11),a={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:o(),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),s.isFormData(e)||s.isArrayBuffer(e)||s.isBuffer(e)||s.isStream(e)||s.isFile(e)||s.isBlob(e)?e:s.isArrayBufferView(e)?e.buffer:s.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):s.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},s.forEach(["delete","get","head"],function(e){u.headers[e]={}}),s.forEach(["post","put","patch"],function(e){u.headers[e]=s.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);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(2),o=n(13),s=n(16),i=n(5),a=n(17),u=n(20),c=n(21),f=n(14);e.exports=function(e){return new Promise(function(t,n){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(h+":"+m)}var y=a(e.baseURL,e.url);if(l.open(e.method.toUpperCase(),i(y,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l.onreadystatechange=function(){if(l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in l?u(l.getAllResponseHeaders()):null,s=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:s,status:l.status,statusText:l.statusText,headers:r,config:e,request:l};o(t,n,i),l=null}},l.onabort=function(){l&&(n(f("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(f("Network Error",e,null,l)),l=null},l.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(f(t,e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=(e.withCredentials||c(y))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;g&&(d[e.xsrfHeaderName]=g)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),r.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),n(e),l=null)}),p||(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n,o,s){var i=new Error(e);return r(i,t,n,o,s)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.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}},e}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,s,i){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(s)&&a.push("domain="+s),i===!0&&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)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";var r=n(18),o=n(19);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2),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,s,i={};return e?(r.forEach(e.split("\n"),function(e){if(s=e.indexOf(":"),t=r.trim(e.substr(0,s)).toLowerCase(),n=r.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?i[t]=(i[t]?i[t]:[]).concat([n]):i[t]=i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){function n(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 o(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(s[o]=n(void 0,e[o])):s[o]=n(e[o],t[o])}t=t||{};var s={},i=["url","method","data"],a=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],c=["validateStatus"];r.forEach(i,function(e){r.isUndefined(t[e])||(s[e]=n(void 0,t[e]))}),r.forEach(a,o),r.forEach(u,function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(s[o]=n(void 0,e[o])):s[o]=n(void 0,t[o])}),r.forEach(c,function(r){r in t?s[r]=n(e[r],t[r]):r in e&&(s[r]=n(void 0,e[r]))});var f=i.concat(a).concat(u).concat(c),p=Object.keys(e).concat(Object.keys(t)).filter(function(e){return f.indexOf(e)===-1});return r.forEach(p,o),s}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(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;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t){"use strict";e.exports=function(e){return"object"==typeof e&&e.isAxiosError===!0}}])});
+//# sourceMappingURL=axios.min.map \ No newline at end of file
diff --git a/dist/axios.min.map b/dist/axios.min.map
new file mode 100644
index 0000000..a897631
--- /dev/null
+++ b/dist/axios.min.map
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///axios.min.js","webpack:///webpack/bootstrap 081842adca0968bb3270","webpack:///./index.js","webpack:///./lib/axios.js","webpack:///./lib/utils.js","webpack:///./lib/helpers/bind.js","webpack:///./lib/core/Axios.js","webpack:///./lib/helpers/buildURL.js","webpack:///./lib/core/InterceptorManager.js","webpack:///./lib/core/dispatchRequest.js","webpack:///./lib/core/transformData.js","webpack:///./lib/cancel/isCancel.js","webpack:///./lib/defaults.js","webpack:///./lib/helpers/normalizeHeaderName.js","webpack:///./lib/adapters/xhr.js","webpack:///./lib/core/settle.js","webpack:///./lib/core/createError.js","webpack:///./lib/core/enhanceError.js","webpack:///./lib/helpers/cookies.js","webpack:///./lib/core/buildFullPath.js","webpack:///./lib/helpers/isAbsoluteURL.js","webpack:///./lib/helpers/combineURLs.js","webpack:///./lib/helpers/parseHeaders.js","webpack:///./lib/helpers/isURLSameOrigin.js","webpack:///./lib/core/mergeConfig.js","webpack:///./lib/cancel/Cancel.js","webpack:///./lib/cancel/CancelToken.js","webpack:///./lib/helpers/spread.js","webpack:///./lib/helpers/isAxiosError.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","createInstance","defaultConfig","context","Axios","instance","bind","prototype","request","utils","extend","mergeConfig","defaults","axios","create","instanceConfig","Cancel","CancelToken","isCancel","all","promises","Promise","spread","isAxiosError","default","isArray","val","toString","isUndefined","isBuffer","constructor","isArrayBuffer","isFormData","FormData","isArrayBufferView","result","ArrayBuffer","isView","buffer","isString","isNumber","isObject","isPlainObject","Object","getPrototypeOf","isDate","isFile","isBlob","isFunction","isStream","pipe","isURLSearchParams","URLSearchParams","trim","str","replace","isStandardBrowserEnv","navigator","product","window","document","forEach","obj","fn","i","l","length","key","hasOwnProperty","merge","assignValue","slice","arguments","a","b","thisArg","stripBOM","content","charCodeAt","args","Array","apply","interceptors","InterceptorManager","response","buildURL","dispatchRequest","config","url","method","toLowerCase","chain","undefined","promise","resolve","interceptor","unshift","fulfilled","rejected","push","then","shift","getUri","params","paramsSerializer","data","encode","encodeURIComponent","serializedParams","parts","v","toISOString","JSON","stringify","join","hashmarkIndex","indexOf","handlers","use","eject","h","throwIfCancellationRequested","cancelToken","throwIfRequested","transformData","headers","transformRequest","common","adapter","transformResponse","reason","reject","fns","value","__CANCEL__","setContentTypeIfUnset","getDefaultAdapter","XMLHttpRequest","process","normalizeHeaderName","DEFAULT_CONTENT_TYPE","Content-Type","parse","e","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","status","Accept","normalizedName","name","toUpperCase","settle","cookies","buildFullPath","parseHeaders","isURLSameOrigin","createError","requestData","requestHeaders","auth","username","password","unescape","Authorization","btoa","fullPath","baseURL","open","onreadystatechange","readyState","responseURL","responseHeaders","getAllResponseHeaders","responseData","responseType","responseText","statusText","onabort","onerror","ontimeout","timeoutErrorMessage","xsrfValue","withCredentials","read","setRequestHeader","onDownloadProgress","addEventListener","onUploadProgress","upload","cancel","abort","send","enhanceError","message","code","error","Error","toJSON","description","number","fileName","lineNumber","columnNumber","stack","write","expires","path","domain","secure","cookie","Date","toGMTString","match","RegExp","decodeURIComponent","remove","now","isAbsoluteURL","combineURLs","requestedURL","test","relativeURL","ignoreDuplicateOf","parsed","split","line","substr","concat","resolveURL","href","msie","urlParsingNode","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","originURL","userAgent","createElement","location","requestURL","config1","config2","getMergedValue","target","source","mergeDeepProperties","prop","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","axiosKeys","otherKeys","keys","filter","executor","TypeError","resolvePromise","token","callback","arr","payload"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,MAAAD,IAEAD,EAAA,MAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAAUL,EAAQD,EAASM,GEtDjCL,EAAAD,QAAAM,EAAA,IF4DM,SAAUL,EAAQD,EAASM,GG5DjC,YAcA,SAAAS,GAAAC,GACA,GAAAC,GAAA,GAAAC,GAAAF,GACAG,EAAAC,EAAAF,EAAAG,UAAAC,QAAAL,EAQA,OALAM,GAAAC,OAAAL,EAAAD,EAAAG,UAAAJ,GAGAM,EAAAC,OAAAL,EAAAF,GAEAE,EAtBA,GAAAI,GAAAjB,EAAA,GACAc,EAAAd,EAAA,GACAY,EAAAZ,EAAA,GACAmB,EAAAnB,EAAA,IACAoB,EAAApB,EAAA,IAsBAqB,EAAAZ,EAAAW,EAGAC,GAAAT,QAGAS,EAAAC,OAAA,SAAAC,GACA,MAAAd,GAAAU,EAAAE,EAAAD,SAAAG,KAIAF,EAAAG,OAAAxB,EAAA,IACAqB,EAAAI,YAAAzB,EAAA,IACAqB,EAAAK,SAAA1B,EAAA,GAGAqB,EAAAM,IAAA,SAAAC,GACA,MAAAC,SAAAF,IAAAC,IAEAP,EAAAS,OAAA9B,EAAA,IAGAqB,EAAAU,aAAA/B,EAAA,IAEAL,EAAAD,QAAA2B,EAGA1B,EAAAD,QAAAsC,QAAAX,GHmEM,SAAU1B,EAAQD,EAASM,GI1HjC,YAgBA,SAAAiC,GAAAC,GACA,yBAAAC,EAAA9B,KAAA6B,GASA,QAAAE,GAAAF,GACA,yBAAAA,GASA,QAAAG,GAAAH,GACA,cAAAA,IAAAE,EAAAF,IAAA,OAAAA,EAAAI,cAAAF,EAAAF,EAAAI,cACA,kBAAAJ,GAAAI,YAAAD,UAAAH,EAAAI,YAAAD,SAAAH,GASA,QAAAK,GAAAL,GACA,+BAAAC,EAAA9B,KAAA6B,GASA,QAAAM,GAAAN,GACA,yBAAAO,WAAAP,YAAAO,UASA,QAAAC,GAAAR,GACA,GAAAS,EAMA,OAJAA,GADA,mBAAAC,0BAAA,OACAA,YAAAC,OAAAX,GAEA,GAAAA,EAAA,QAAAA,EAAAY,iBAAAF,aAWA,QAAAG,GAAAb,GACA,sBAAAA,GASA,QAAAc,GAAAd,GACA,sBAAAA,GASA,QAAAe,GAAAf,GACA,cAAAA,GAAA,gBAAAA,GASA,QAAAgB,GAAAhB,GACA,uBAAAC,EAAA9B,KAAA6B,GACA,QAGA,IAAAnB,GAAAoC,OAAAC,eAAAlB,EACA,eAAAnB,OAAAoC,OAAApC,UASA,QAAAsC,GAAAnB,GACA,wBAAAC,EAAA9B,KAAA6B,GASA,QAAAoB,GAAApB,GACA,wBAAAC,EAAA9B,KAAA6B,GASA,QAAAqB,GAAArB,GACA,wBAAAC,EAAA9B,KAAA6B,GASA,QAAAsB,GAAAtB,GACA,4BAAAC,EAAA9B,KAAA6B,GASA,QAAAuB,GAAAvB,GACA,MAAAe,GAAAf,IAAAsB,EAAAtB,EAAAwB,MASA,QAAAC,GAAAzB,GACA,yBAAA0B,kBAAA1B,YAAA0B,iBASA,QAAAC,GAAAC,GACA,MAAAA,GAAAC,QAAA,WAAAA,QAAA,WAkBA,QAAAC,KACA,0BAAAC,YAAA,gBAAAA,UAAAC,SACA,iBAAAD,UAAAC,SACA,OAAAD,UAAAC,WAIA,mBAAAC,SACA,mBAAAC,WAgBA,QAAAC,GAAAC,EAAAC,GAEA,UAAAD,GAAA,mBAAAA,GAUA,GALA,gBAAAA,KAEAA,OAGArC,EAAAqC,GAEA,OAAAE,GAAA,EAAAC,EAAAH,EAAAI,OAAmCF,EAAAC,EAAOD,IAC1CD,EAAAlE,KAAA,KAAAiE,EAAAE,KAAAF,OAIA,QAAAK,KAAAL,GACAnB,OAAApC,UAAA6D,eAAAvE,KAAAiE,EAAAK,IACAJ,EAAAlE,KAAA,KAAAiE,EAAAK,KAAAL,GAuBA,QAAAO,KAEA,QAAAC,GAAA5C,EAAAyC,GACAzB,EAAAP,EAAAgC,KAAAzB,EAAAhB,GACAS,EAAAgC,GAAAE,EAAAlC,EAAAgC,GAAAzC,GACKgB,EAAAhB,GACLS,EAAAgC,GAAAE,KAA4B3C,GACvBD,EAAAC,GACLS,EAAAgC,GAAAzC,EAAA6C,QAEApC,EAAAgC,GAAAzC,EAIA,OAbAS,MAaA6B,EAAA,EAAAC,EAAAO,UAAAN,OAAuCF,EAAAC,EAAOD,IAC9CH,EAAAW,UAAAR,GAAAM,EAEA,OAAAnC,GAWA,QAAAzB,GAAA+D,EAAAC,EAAAC,GAQA,MAPAd,GAAAa,EAAA,SAAAhD,EAAAyC,GACAQ,GAAA,kBAAAjD,GACA+C,EAAAN,GAAA7D,EAAAoB,EAAAiD,GAEAF,EAAAN,GAAAzC,IAGA+C,EASA,QAAAG,GAAAC,GAIA,MAHA,SAAAA,EAAAC,WAAA,KACAD,IAAAN,MAAA,IAEAM,EAlUA,GAAAvE,GAAAd,EAAA,GAMAmC,EAAAgB,OAAApC,UAAAoB,QA+TAxC,GAAAD,SACAuC,UACAM,gBACAF,WACAG,aACAE,oBACAK,WACAC,WACAC,WACAC,gBACAd,cACAiB,SACAC,SACAC,SACAC,aACAC,WACAE,oBACAK,uBACAK,UACAQ,QACA3D,SACA2C,OACAuB,aJkIM,SAAUzF,EAAQD,GK/dxB,YAEAC,GAAAD,QAAA,SAAA6E,EAAAY,GACA,kBAEA,OADAI,GAAA,GAAAC,OAAAR,UAAAN,QACAF,EAAA,EAAmBA,EAAAe,EAAAb,OAAiBF,IACpCe,EAAAf,GAAAQ,UAAAR,EAEA,OAAAD,GAAAkB,MAAAN,EAAAI,MLweM,SAAU5F,EAAQD,EAASM,GMhfjC,YAaA,SAAAY,GAAAW,GACAzB,KAAAsB,SAAAG,EACAzB,KAAA4F,cACA1E,QAAA,GAAA2E,GACAC,SAAA,GAAAD,IAfA,GAAA1E,GAAAjB,EAAA,GACA6F,EAAA7F,EAAA,GACA2F,EAAA3F,EAAA,GACA8F,EAAA9F,EAAA,GACAmB,EAAAnB,EAAA,GAoBAY,GAAAG,UAAAC,QAAA,SAAA+E,GAGA,gBAAAA,IACAA,EAAAf,UAAA,OACAe,EAAAC,IAAAhB,UAAA,IAEAe,QAGAA,EAAA5E,EAAArB,KAAAsB,SAAA2E,GAGAA,EAAAE,OACAF,EAAAE,OAAAF,EAAAE,OAAAC,cACGpG,KAAAsB,SAAA6E,OACHF,EAAAE,OAAAnG,KAAAsB,SAAA6E,OAAAC,cAEAH,EAAAE,OAAA,KAIA,IAAAE,IAAAL,EAAAM,QACAC,EAAAxE,QAAAyE,QAAAP,EAUA,KARAjG,KAAA4F,aAAA1E,QAAAqD,QAAA,SAAAkC,GACAJ,EAAAK,QAAAD,EAAAE,UAAAF,EAAAG,YAGA5G,KAAA4F,aAAAE,SAAAvB,QAAA,SAAAkC,GACAJ,EAAAQ,KAAAJ,EAAAE,UAAAF,EAAAG,YAGAP,EAAAzB,QACA2B,IAAAO,KAAAT,EAAAU,QAAAV,EAAAU,QAGA,OAAAR,IAGAzF,EAAAG,UAAA+F,OAAA,SAAAf,GAEA,MADAA,GAAA5E,EAAArB,KAAAsB,SAAA2E,GACAF,EAAAE,EAAAC,IAAAD,EAAAgB,OAAAhB,EAAAiB,kBAAAjD,QAAA,WAIA9C,EAAAoD,SAAA,0CAAA4B,GAEArF,EAAAG,UAAAkF,GAAA,SAAAD,EAAAD,GACA,MAAAjG,MAAAkB,QAAAG,EAAA4E,OACAE,SACAD,MACAiB,MAAAlB,OAAyBkB,WAKzBhG,EAAAoD,SAAA,+BAAA4B,GAEArF,EAAAG,UAAAkF,GAAA,SAAAD,EAAAiB,EAAAlB,GACA,MAAAjG,MAAAkB,QAAAG,EAAA4E,OACAE,SACAD,MACAiB,aAKAtH,EAAAD,QAAAkB,GNufM,SAAUjB,EAAQD,EAASM,GOrlBjC,YAIA,SAAAkH,GAAAhF,GACA,MAAAiF,oBAAAjF,GACA6B,QAAA,aACAA,QAAA,YACAA,QAAA,aACAA,QAAA,YACAA,QAAA,aACAA,QAAA,aATA,GAAA9C,GAAAjB,EAAA,EAmBAL,GAAAD,QAAA,SAAAsG,EAAAe,EAAAC,GAEA,IAAAD,EACA,MAAAf,EAGA,IAAAoB,EACA,IAAAJ,EACAI,EAAAJ,EAAAD,OACG,IAAA9F,EAAA0C,kBAAAoD,GACHK,EAAAL,EAAA5E,eACG,CACH,GAAAkF,KAEApG,GAAAoD,QAAA0C,EAAA,SAAA7E,EAAAyC,GACA,OAAAzC,GAAA,mBAAAA,KAIAjB,EAAAgB,QAAAC,GACAyC,GAAA,KAEAzC,MAGAjB,EAAAoD,QAAAnC,EAAA,SAAAoF,GACArG,EAAAoC,OAAAiE,GACAA,IAAAC,cACStG,EAAAgC,SAAAqE,KACTA,EAAAE,KAAAC,UAAAH,IAEAD,EAAAV,KAAAO,EAAAvC,GAAA,IAAAuC,EAAAI,SAIAF,EAAAC,EAAAK,KAAA,KAGA,GAAAN,EAAA,CACA,GAAAO,GAAA3B,EAAA4B,QAAA,IACAD,MAAA,IACA3B,IAAAjB,MAAA,EAAA4C,IAGA3B,MAAA4B,QAAA,mBAAAR,EAGA,MAAApB,KP6lBM,SAAUrG,EAAQD,EAASM,GQjqBjC,YAIA,SAAA2F,KACA7F,KAAA+H,YAHA,GAAA5G,GAAAjB,EAAA,EAcA2F,GAAA5E,UAAA+G,IAAA,SAAArB,EAAAC,GAKA,MAJA5G,MAAA+H,SAAAlB,MACAF,YACAC,aAEA5G,KAAA+H,SAAAnD,OAAA,GAQAiB,EAAA5E,UAAAgH,MAAA,SAAA5H,GACAL,KAAA+H,SAAA1H,KACAL,KAAA+H,SAAA1H,GAAA,OAYAwF,EAAA5E,UAAAsD,QAAA,SAAAE,GACAtD,EAAAoD,QAAAvE,KAAA+H,SAAA,SAAAG,GACA,OAAAA,GACAzD,EAAAyD,MAKArI,EAAAD,QAAAiG,GRwqBM,SAAUhG,EAAQD,EAASM,GS3tBjC,YAUA,SAAAiI,GAAAlC,GACAA,EAAAmC,aACAnC,EAAAmC,YAAAC,mBAVA,GAAAlH,GAAAjB,EAAA,GACAoI,EAAApI,EAAA,GACA0B,EAAA1B,EAAA,GACAoB,EAAApB,EAAA,GAiBAL,GAAAD,QAAA,SAAAqG,GACAkC,EAAAlC,GAGAA,EAAAsC,QAAAtC,EAAAsC,YAGAtC,EAAAkB,KAAAmB,EACArC,EAAAkB,KACAlB,EAAAsC,QACAtC,EAAAuC,kBAIAvC,EAAAsC,QAAApH,EAAA4D,MACAkB,EAAAsC,QAAAE,WACAxC,EAAAsC,QAAAtC,EAAAE,YACAF,EAAAsC,SAGApH,EAAAoD,SACA,qDACA,SAAA4B,SACAF,GAAAsC,QAAApC,IAIA,IAAAuC,GAAAzC,EAAAyC,SAAApH,EAAAoH,OAEA,OAAAA,GAAAzC,GAAAa,KAAA,SAAAhB,GAUA,MATAqC,GAAAlC,GAGAH,EAAAqB,KAAAmB,EACAxC,EAAAqB,KACArB,EAAAyC,QACAtC,EAAA0C,mBAGA7C,GACG,SAAA8C,GAcH,MAbAhH,GAAAgH,KACAT,EAAAlC,GAGA2C,KAAA9C,WACA8C,EAAA9C,SAAAqB,KAAAmB,EACAM,EAAA9C,SAAAqB,KACAyB,EAAA9C,SAAAyC,QACAtC,EAAA0C,qBAKA5G,QAAA8G,OAAAD,OTouBM,SAAU/I,EAAQD,EAASM,GUhzBjC,YAEA,IAAAiB,GAAAjB,EAAA,EAUAL,GAAAD,QAAA,SAAAuH,EAAAoB,EAAAO,GAMA,MAJA3H,GAAAoD,QAAAuE,EAAA,SAAArE,GACA0C,EAAA1C,EAAA0C,EAAAoB,KAGApB,IVwzBM,SAAUtH,EAAQD,GW10BxB,YAEAC,GAAAD,QAAA,SAAAmJ,GACA,SAAAA,MAAAC,cXk1BM,SAAUnJ,EAAQD,EAASM,GYr1BjC,YASA,SAAA+I,GAAAV,EAAAQ,IACA5H,EAAAmB,YAAAiG,IAAApH,EAAAmB,YAAAiG,EAAA,mBACAA,EAAA,gBAAAQ,GAIA,QAAAG,KACA,GAAAR,EAQA,OAPA,mBAAAS,gBAEAT,EAAAxI,EAAA,IACG,mBAAAkJ,UAAA,qBAAA/F,OAAApC,UAAAoB,SAAA9B,KAAA6I,WAEHV,EAAAxI,EAAA,KAEAwI,EAtBA,GAAAvH,GAAAjB,EAAA,GACAmJ,EAAAnJ,EAAA,IAEAoJ,GACAC,eAAA,qCAqBAjI,GACAoH,QAAAQ,IAEAV,kBAAA,SAAArB,EAAAoB,GAGA,MAFAc,GAAAd,EAAA,UACAc,EAAAd,EAAA,gBACApH,EAAAuB,WAAAyE,IACAhG,EAAAsB,cAAA0E,IACAhG,EAAAoB,SAAA4E,IACAhG,EAAAwC,SAAAwD,IACAhG,EAAAqC,OAAA2D,IACAhG,EAAAsC,OAAA0D,GAEAA,EAEAhG,EAAAyB,kBAAAuE,GACAA,EAAAnE,OAEA7B,EAAA0C,kBAAAsD,IACA8B,EAAAV,EAAA,mDACApB,EAAA9E,YAEAlB,EAAAgC,SAAAgE,IACA8B,EAAAV,EAAA,kCACAb,KAAAC,UAAAR,IAEAA,IAGAwB,mBAAA,SAAAxB,GAEA,mBAAAA,GACA,IACAA,EAAAO,KAAA8B,MAAArC,GACO,MAAAsC,IAEP,MAAAtC,KAOAuC,QAAA,EAEAC,eAAA,aACAC,eAAA,eAEAC,kBAAA,EACAC,eAAA,EAEAC,eAAA,SAAAC,GACA,MAAAA,IAAA,KAAAA,EAAA,KAIA1I,GAAAiH,SACAE,QACAwB,OAAA,sCAIA9I,EAAAoD,SAAA,gCAAA4B,GACA7E,EAAAiH,QAAApC,QAGAhF,EAAAoD,SAAA,+BAAA4B,GACA7E,EAAAiH,QAAApC,GAAAhF,EAAA4D,MAAAuE,KAGAzJ,EAAAD,QAAA0B,GZ41BM,SAAUzB,EAAQD,EAASM,Ga77BjC,YAEA,IAAAiB,GAAAjB,EAAA,EAEAL,GAAAD,QAAA,SAAA2I,EAAA2B,GACA/I,EAAAoD,QAAAgE,EAAA,SAAAQ,EAAAoB,GACAA,IAAAD,GAAAC,EAAAC,gBAAAF,EAAAE,gBACA7B,EAAA2B,GAAAnB,QACAR,GAAA4B,Qbu8BM,SAAUtK,EAAQD,EAASM,Gc/8BjC,YAEA,IAAAiB,GAAAjB,EAAA,GACAmK,EAAAnK,EAAA,IACAoK,EAAApK,EAAA,IACA6F,EAAA7F,EAAA,GACAqK,EAAArK,EAAA,IACAsK,EAAAtK,EAAA,IACAuK,EAAAvK,EAAA,IACAwK,EAAAxK,EAAA,GAEAL,GAAAD,QAAA,SAAAqG,GACA,UAAAlE,SAAA,SAAAyE,EAAAqC,GACA,GAAA8B,GAAA1E,EAAAkB,KACAyD,EAAA3E,EAAAsC,OAEApH,GAAAuB,WAAAiI,UACAC,GAAA,eAGA,IAAA1J,GAAA,GAAAiI,eAGA,IAAAlD,EAAA4E,KAAA,CACA,GAAAC,GAAA7E,EAAA4E,KAAAC,UAAA,GACAC,EAAA9E,EAAA4E,KAAAE,SAAAC,SAAA3D,mBAAApB,EAAA4E,KAAAE,WAAA,EACAH,GAAAK,cAAA,SAAAC,KAAAJ,EAAA,IAAAC,GAGA,GAAAI,GAAAZ,EAAAtE,EAAAmF,QAAAnF,EAAAC,IA4EA,IA3EAhF,EAAAmK,KAAApF,EAAAE,OAAAiE,cAAArE,EAAAoF,EAAAlF,EAAAgB,OAAAhB,EAAAiB,mBAAA,GAGAhG,EAAAwI,QAAAzD,EAAAyD,QAGAxI,EAAAoK,mBAAA,WACA,GAAApK,GAAA,IAAAA,EAAAqK,aAQA,IAAArK,EAAA8I,QAAA9I,EAAAsK,aAAA,IAAAtK,EAAAsK,YAAA1D,QAAA,WAKA,GAAA2D,GAAA,yBAAAvK,GAAAsJ,EAAAtJ,EAAAwK,yBAAA,KACAC,EAAA1F,EAAA2F,cAAA,SAAA3F,EAAA2F,aAAA1K,EAAA4E,SAAA5E,EAAA2K,aACA/F,GACAqB,KAAAwE,EACA3B,OAAA9I,EAAA8I,OACA8B,WAAA5K,EAAA4K,WACAvD,QAAAkD,EACAxF,SACA/E,UAGAmJ,GAAA7D,EAAAqC,EAAA/C,GAGA5E,EAAA,OAIAA,EAAA6K,QAAA,WACA7K,IAIA2H,EAAA6B,EAAA,kBAAAzE,EAAA,eAAA/E,IAGAA,EAAA,OAIAA,EAAA8K,QAAA,WAGAnD,EAAA6B,EAAA,gBAAAzE,EAAA,KAAA/E,IAGAA,EAAA,MAIAA,EAAA+K,UAAA,WACA,GAAAC,GAAA,cAAAjG,EAAAyD,QAAA,aACAzD,GAAAiG,sBACAA,EAAAjG,EAAAiG,qBAEArD,EAAA6B,EAAAwB,EAAAjG,EAAA,eACA/E,IAGAA,EAAA,MAMAC,EAAA+C,uBAAA,CAEA,GAAAiI,IAAAlG,EAAAmG,iBAAA3B,EAAAU,KAAAlF,EAAA0D,eACAW,EAAA+B,KAAApG,EAAA0D,gBACArD,MAEA6F,KACAvB,EAAA3E,EAAA2D,gBAAAuC,GAuBA,GAlBA,oBAAAjL,IACAC,EAAAoD,QAAAqG,EAAA,SAAAxI,EAAAyC,GACA,mBAAA8F,IAAA,iBAAA9F,EAAAuB,oBAEAwE,GAAA/F,GAGA3D,EAAAoL,iBAAAzH,EAAAzC,KAMAjB,EAAAmB,YAAA2D,EAAAmG,mBACAlL,EAAAkL,kBAAAnG,EAAAmG,iBAIAnG,EAAA2F,aACA,IACA1K,EAAA0K,aAAA3F,EAAA2F,aACO,MAAAnC,GAGP,YAAAxD,EAAA2F,aACA,KAAAnC,GAMA,kBAAAxD,GAAAsG,oBACArL,EAAAsL,iBAAA,WAAAvG,EAAAsG,oBAIA,kBAAAtG,GAAAwG,kBAAAvL,EAAAwL,QACAxL,EAAAwL,OAAAF,iBAAA,WAAAvG,EAAAwG,kBAGAxG,EAAAmC,aAEAnC,EAAAmC,YAAA7B,QAAAO,KAAA,SAAA6F,GACAzL,IAIAA,EAAA0L,QACA/D,EAAA8D,GAEAzL,EAAA,QAIAyJ,IACAA,EAAA,MAIAzJ,EAAA2L,KAAAlC,Odw9BM,SAAU9K,EAAQD,EAASM,GexoCjC,YAEA,IAAAwK,GAAAxK,EAAA,GASAL,GAAAD,QAAA,SAAA4G,EAAAqC,EAAA/C,GACA,GAAAiE,GAAAjE,EAAAG,OAAA8D,cACAjE,GAAAkE,QAAAD,MAAAjE,EAAAkE,QAGAnB,EAAA6B,EACA,mCAAA5E,EAAAkE,OACAlE,EAAAG,OACA,KACAH,EAAA5E,QACA4E,IAPAU,EAAAV,KfypCM,SAAUjG,EAAQD,EAASM,GgBvqCjC,YAEA,IAAA4M,GAAA5M,EAAA,GAYAL,GAAAD,QAAA,SAAAmN,EAAA9G,EAAA+G,EAAA9L,EAAA4E,GACA,GAAAmH,GAAA,GAAAC,OAAAH,EACA,OAAAD,GAAAG,EAAAhH,EAAA+G,EAAA9L,EAAA4E,KhB+qCM,SAAUjG,EAAQD,GiB/rCxB,YAYAC,GAAAD,QAAA,SAAAqN,EAAAhH,EAAA+G,EAAA9L,EAAA4E,GA4BA,MA3BAmH,GAAAhH,SACA+G,IACAC,EAAAD,QAGAC,EAAA/L,UACA+L,EAAAnH,WACAmH,EAAAhL,cAAA,EAEAgL,EAAAE,OAAA,WACA,OAEAJ,QAAA/M,KAAA+M,QACA5C,KAAAnK,KAAAmK,KAEAiD,YAAApN,KAAAoN,YACAC,OAAArN,KAAAqN,OAEAC,SAAAtN,KAAAsN,SACAC,WAAAvN,KAAAuN,WACAC,aAAAxN,KAAAwN,aACAC,MAAAzN,KAAAyN,MAEAxH,OAAAjG,KAAAiG,OACA+G,KAAAhN,KAAAgN,OAGAC,IjBusCM,SAAUpN,EAAQD,EAASM,GkB/uCjC,YAEA,IAAAiB,GAAAjB,EAAA,EAEAL,GAAAD,QACAuB,EAAA+C,uBAGA,WACA,OACAwJ,MAAA,SAAAvD,EAAApB,EAAA4E,EAAAC,EAAAC,EAAAC,GACA,GAAAC,KACAA,GAAAlH,KAAAsD,EAAA,IAAA9C,mBAAA0B,IAEA5H,EAAA+B,SAAAyK,IACAI,EAAAlH,KAAA,cAAAmH,MAAAL,GAAAM,eAGA9M,EAAA8B,SAAA2K,IACAG,EAAAlH,KAAA,QAAA+G,GAGAzM,EAAA8B,SAAA4K,IACAE,EAAAlH,KAAA,UAAAgH,GAGAC,KAAA,GACAC,EAAAlH,KAAA,UAGAvC,SAAAyJ,SAAAnG,KAAA,OAGAyE,KAAA,SAAAlC,GACA,GAAA+D,GAAA5J,SAAAyJ,OAAAG,MAAA,GAAAC,QAAA,aAA4DhE,EAAA,aAC5D,OAAA+D,GAAAE,mBAAAF,EAAA,UAGAG,OAAA,SAAAlE,GACAnK,KAAA0N,MAAAvD,EAAA,GAAA6D,KAAAM,MAAA,YAMA,WACA,OACAZ,MAAA,aACArB,KAAA,WAA+B,aAC/BgC,OAAA,kBlByvCM,SAAUxO,EAAQD,EAASM,GmB1yCjC,YAEA,IAAAqO,GAAArO,EAAA,IACAsO,EAAAtO,EAAA,GAWAL,GAAAD,QAAA,SAAAwL,EAAAqD,GACA,MAAArD,KAAAmD,EAAAE,GACAD,EAAApD,EAAAqD,GAEAA,InBkzCM,SAAU5O,EAAQD,GoBp0CxB,YAQAC,GAAAD,QAAA,SAAAsG,GAIA,sCAAAwI,KAAAxI,KpB40CM,SAAUrG,EAAQD,GqBx1CxB,YASAC,GAAAD,QAAA,SAAAwL,EAAAuD,GACA,MAAAA,GACAvD,EAAAnH,QAAA,eAAA0K,EAAA1K,QAAA,WACAmH,IrBg2CM,SAAUvL,EAAQD,EAASM,GsB52CjC,YAEA,IAAAiB,GAAAjB,EAAA,GAIA0O,GACA,6DACA,kEACA,gEACA,qCAgBA/O,GAAAD,QAAA,SAAA2I,GACA,GACA1D,GACAzC,EACAsC,EAHAmK,IAKA,OAAAtG,IAEApH,EAAAoD,QAAAgE,EAAAuG,MAAA,eAAAC,GAKA,GAJArK,EAAAqK,EAAAjH,QAAA,KACAjD,EAAA1D,EAAA4C,KAAAgL,EAAAC,OAAA,EAAAtK,IAAA0B,cACAhE,EAAAjB,EAAA4C,KAAAgL,EAAAC,OAAAtK,EAAA,IAEAG,EAAA,CACA,GAAAgK,EAAAhK,IAAA+J,EAAA9G,QAAAjD,IAAA,EACA,MAEA,gBAAAA,EACAgK,EAAAhK,IAAAgK,EAAAhK,GAAAgK,EAAAhK,OAAAoK,QAAA7M,IAEAyM,EAAAhK,GAAAgK,EAAAhK,GAAAgK,EAAAhK,GAAA,KAAAzC,OAKAyM,GAnBiBA,ItBu4CX,SAAUhP,EAAQD,EAASM,GuBv6CjC,YAEA,IAAAiB,GAAAjB,EAAA,EAEAL,GAAAD,QACAuB,EAAA+C,uBAIA,WAWA,QAAAgL,GAAAhJ,GACA,GAAAiJ,GAAAjJ,CAWA,OATAkJ,KAEAC,EAAAC,aAAA,OAAAH,GACAA,EAAAE,EAAAF,MAGAE,EAAAC,aAAA,OAAAH,IAIAA,KAAAE,EAAAF,KACAI,SAAAF,EAAAE,SAAAF,EAAAE,SAAAtL,QAAA,YACAuL,KAAAH,EAAAG,KACAC,OAAAJ,EAAAI,OAAAJ,EAAAI,OAAAxL,QAAA,aACAyL,KAAAL,EAAAK,KAAAL,EAAAK,KAAAzL,QAAA,YACA0L,SAAAN,EAAAM,SACAC,KAAAP,EAAAO,KACAC,SAAA,MAAAR,EAAAQ,SAAAC,OAAA,GACAT,EAAAQ,SACA,IAAAR,EAAAQ,UAhCA,GAEAE,GAFAX,EAAA,kBAAAV,KAAAvK,UAAA6L,WACAX,EAAA/K,SAAA2L,cAAA,IA2CA,OARAF,GAAAb,EAAA7K,OAAA6L,SAAAf,MAQA,SAAAgB,GACA,GAAAtB,GAAA1N,EAAA8B,SAAAkN,GAAAjB,EAAAiB,IACA,OAAAtB,GAAAU,WAAAQ,EAAAR,UACAV,EAAAW,OAAAO,EAAAP,SAKA,WACA,kBACA,cvBi7CM,SAAU3P,EAAQD,EAASM,GwBj/CjC,YAEA,IAAAiB,GAAAjB,EAAA,EAUAL,GAAAD,QAAA,SAAAwQ,EAAAC,GAgBA,QAAAC,GAAAC,EAAAC,GACA,MAAArP,GAAAiC,cAAAmN,IAAApP,EAAAiC,cAAAoN,GACArP,EAAA4D,MAAAwL,EAAAC,GACKrP,EAAAiC,cAAAoN,GACLrP,EAAA4D,SAA2ByL,GACtBrP,EAAAgB,QAAAqO,GACLA,EAAAvL,QAEAuL,EAGA,QAAAC,GAAAC,GACAvP,EAAAmB,YAAA+N,EAAAK,IAEKvP,EAAAmB,YAAA8N,EAAAM,MACLzK,EAAAyK,GAAAJ,EAAAhK,OAAA8J,EAAAM,KAFAzK,EAAAyK,GAAAJ,EAAAF,EAAAM,GAAAL,EAAAK,IA3BAL,OACA,IAAApK,MAEA0K,GAAA,uBACAC,GAAA,mCACAC,GACA,oEACA,uFACA,sEACA,0EACA,4DAEAC,GAAA,iBAqBA3P,GAAAoD,QAAAoM,EAAA,SAAAD,GACAvP,EAAAmB,YAAA+N,EAAAK,MACAzK,EAAAyK,GAAAJ,EAAAhK,OAAA+J,EAAAK,OAIAvP,EAAAoD,QAAAqM,EAAAH,GAEAtP,EAAAoD,QAAAsM,EAAA,SAAAH,GACAvP,EAAAmB,YAAA+N,EAAAK,IAEKvP,EAAAmB,YAAA8N,EAAAM,MACLzK,EAAAyK,GAAAJ,EAAAhK,OAAA8J,EAAAM,KAFAzK,EAAAyK,GAAAJ,EAAAhK,OAAA+J,EAAAK,MAMAvP,EAAAoD,QAAAuM,EAAA,SAAAJ,GACAA,IAAAL,GACApK,EAAAyK,GAAAJ,EAAAF,EAAAM,GAAAL,EAAAK,IACKA,IAAAN,KACLnK,EAAAyK,GAAAJ,EAAAhK,OAAA8J,EAAAM,MAIA,IAAAK,GAAAJ,EACA1B,OAAA2B,GACA3B,OAAA4B,GACA5B,OAAA6B,GAEAE,EAAA3N,OACA4N,KAAAb,GACAnB,OAAA5L,OAAA4N,KAAAZ,IACAa,OAAA,SAAArM,GACA,MAAAkM,GAAAjJ,QAAAjD,MAAA,GAKA,OAFA1D,GAAAoD,QAAAyM,EAAAP,GAEAxK,IxBy/CM,SAAUpG,EAAQD,GyB9kDxB,YAQA,SAAA8B,GAAAqL,GACA/M,KAAA+M,UAGArL,EAAAT,UAAAoB,SAAA,WACA,gBAAArC,KAAA+M,QAAA,KAAA/M,KAAA+M,QAAA,KAGArL,EAAAT,UAAA+H,YAAA,EAEAnJ,EAAAD,QAAA8B,GzBqlDM,SAAU7B,EAAQD,EAASM,G0BvmDjC,YAUA,SAAAyB,GAAAwP,GACA,qBAAAA,GACA,SAAAC,WAAA,+BAGA,IAAAC,EACArR,MAAAuG,QAAA,GAAAxE,SAAA,SAAAyE,GACA6K,EAAA7K,GAGA,IAAA8K,GAAAtR,IACAmR,GAAA,SAAApE,GACAuE,EAAA1I,SAKA0I,EAAA1I,OAAA,GAAAlH,GAAAqL,GACAsE,EAAAC,EAAA1I,WA1BA,GAAAlH,GAAAxB,EAAA,GAiCAyB,GAAAV,UAAAoH,iBAAA,WACA,GAAArI,KAAA4I,OACA,KAAA5I,MAAA4I,QAQAjH,EAAA6O,OAAA,WACA,GAAA7D,GACA2E,EAAA,GAAA3P,GAAA,SAAAlB,GACAkM,EAAAlM,GAEA,QACA6Q,QACA3E,WAIA9M,EAAAD,QAAA+B,G1B8mDM,SAAU9B,EAAQD,G2BtqDxB,YAsBAC,GAAAD,QAAA,SAAA2R,GACA,gBAAAC,GACA,MAAAD,GAAA5L,MAAA,KAAA6L,M3B+qDM,SAAU3R,EAAQD,G4BvsDxB,YAQAC,GAAAD,QAAA,SAAA6R,GACA,sBAAAA,MAAAxP,gBAAA","file":"axios.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"axios\"] = factory();\n\telse\n\t\troot[\"axios\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar bind = __webpack_require__(3);\n\tvar Axios = __webpack_require__(4);\n\tvar mergeConfig = __webpack_require__(22);\n\tvar defaults = __webpack_require__(10);\n\t\n\t/**\n\t * Create an instance of Axios\n\t *\n\t * @param {Object} defaultConfig The default config for the instance\n\t * @return {Axios} A new instance of Axios\n\t */\n\tfunction createInstance(defaultConfig) {\n\t var context = new Axios(defaultConfig);\n\t var instance = bind(Axios.prototype.request, context);\n\t\n\t // Copy axios.prototype to instance\n\t utils.extend(instance, Axios.prototype, context);\n\t\n\t // Copy context to instance\n\t utils.extend(instance, context);\n\t\n\t return instance;\n\t}\n\t\n\t// Create the default instance to be exported\n\tvar axios = createInstance(defaults);\n\t\n\t// Expose Axios class to allow class inheritance\n\taxios.Axios = Axios;\n\t\n\t// Factory for creating new instances\n\taxios.create = function create(instanceConfig) {\n\t return createInstance(mergeConfig(axios.defaults, instanceConfig));\n\t};\n\t\n\t// Expose Cancel & CancelToken\n\taxios.Cancel = __webpack_require__(23);\n\taxios.CancelToken = __webpack_require__(24);\n\taxios.isCancel = __webpack_require__(9);\n\t\n\t// Expose all/spread\n\taxios.all = function all(promises) {\n\t return Promise.all(promises);\n\t};\n\taxios.spread = __webpack_require__(25);\n\t\n\t// Expose isAxiosError\n\taxios.isAxiosError = __webpack_require__(26);\n\t\n\tmodule.exports = axios;\n\t\n\t// Allow use of default import syntax in TypeScript\n\tmodule.exports.default = axios;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar bind = __webpack_require__(3);\n\t\n\t/*global toString:true*/\n\t\n\t// utils is a library of generic helper functions non-specific to axios\n\t\n\tvar toString = Object.prototype.toString;\n\t\n\t/**\n\t * Determine if a value is an Array\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an Array, otherwise false\n\t */\n\tfunction isArray(val) {\n\t return toString.call(val) === '[object Array]';\n\t}\n\t\n\t/**\n\t * Determine if a value is undefined\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if the value is undefined, otherwise false\n\t */\n\tfunction isUndefined(val) {\n\t return typeof val === 'undefined';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Buffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Buffer, otherwise false\n\t */\n\tfunction isBuffer(val) {\n\t return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n\t && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n\t}\n\t\n\t/**\n\t * Determine if a value is an ArrayBuffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n\t */\n\tfunction isArrayBuffer(val) {\n\t return toString.call(val) === '[object ArrayBuffer]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a FormData\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an FormData, otherwise false\n\t */\n\tfunction isFormData(val) {\n\t return (typeof FormData !== 'undefined') && (val instanceof FormData);\n\t}\n\t\n\t/**\n\t * Determine if a value is a view on an ArrayBuffer\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n\t */\n\tfunction isArrayBufferView(val) {\n\t var result;\n\t if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n\t result = ArrayBuffer.isView(val);\n\t } else {\n\t result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Determine if a value is a String\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a String, otherwise false\n\t */\n\tfunction isString(val) {\n\t return typeof val === 'string';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Number\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Number, otherwise false\n\t */\n\tfunction isNumber(val) {\n\t return typeof val === 'number';\n\t}\n\t\n\t/**\n\t * Determine if a value is an Object\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is an Object, otherwise false\n\t */\n\tfunction isObject(val) {\n\t return val !== null && typeof val === 'object';\n\t}\n\t\n\t/**\n\t * Determine if a value is a plain Object\n\t *\n\t * @param {Object} val The value to test\n\t * @return {boolean} True if value is a plain Object, otherwise false\n\t */\n\tfunction isPlainObject(val) {\n\t if (toString.call(val) !== '[object Object]') {\n\t return false;\n\t }\n\t\n\t var prototype = Object.getPrototypeOf(val);\n\t return prototype === null || prototype === Object.prototype;\n\t}\n\t\n\t/**\n\t * Determine if a value is a Date\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Date, otherwise false\n\t */\n\tfunction isDate(val) {\n\t return toString.call(val) === '[object Date]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a File\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a File, otherwise false\n\t */\n\tfunction isFile(val) {\n\t return toString.call(val) === '[object File]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Blob\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Blob, otherwise false\n\t */\n\tfunction isBlob(val) {\n\t return toString.call(val) === '[object Blob]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Function\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Function, otherwise false\n\t */\n\tfunction isFunction(val) {\n\t return toString.call(val) === '[object Function]';\n\t}\n\t\n\t/**\n\t * Determine if a value is a Stream\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a Stream, otherwise false\n\t */\n\tfunction isStream(val) {\n\t return isObject(val) && isFunction(val.pipe);\n\t}\n\t\n\t/**\n\t * Determine if a value is a URLSearchParams object\n\t *\n\t * @param {Object} val The value to test\n\t * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n\t */\n\tfunction isURLSearchParams(val) {\n\t return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n\t}\n\t\n\t/**\n\t * Trim excess whitespace off the beginning and end of a string\n\t *\n\t * @param {String} str The String to trim\n\t * @returns {String} The String freed of excess whitespace\n\t */\n\tfunction trim(str) {\n\t return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n\t}\n\t\n\t/**\n\t * Determine if we're running in a standard browser environment\n\t *\n\t * This allows axios to run in a web worker, and react-native.\n\t * Both environments support XMLHttpRequest, but not fully standard globals.\n\t *\n\t * web workers:\n\t * typeof window -> undefined\n\t * typeof document -> undefined\n\t *\n\t * react-native:\n\t * navigator.product -> 'ReactNative'\n\t * nativescript\n\t * navigator.product -> 'NativeScript' or 'NS'\n\t */\n\tfunction isStandardBrowserEnv() {\n\t if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n\t navigator.product === 'NativeScript' ||\n\t navigator.product === 'NS')) {\n\t return false;\n\t }\n\t return (\n\t typeof window !== 'undefined' &&\n\t typeof document !== 'undefined'\n\t );\n\t}\n\t\n\t/**\n\t * Iterate over an Array or an Object invoking a function for each item.\n\t *\n\t * If `obj` is an Array callback will be called passing\n\t * the value, index, and complete array for each item.\n\t *\n\t * If 'obj' is an Object callback will be called passing\n\t * the value, key, and complete object for each property.\n\t *\n\t * @param {Object|Array} obj The object to iterate\n\t * @param {Function} fn The callback to invoke for each item\n\t */\n\tfunction forEach(obj, fn) {\n\t // Don't bother if no value provided\n\t if (obj === null || typeof obj === 'undefined') {\n\t return;\n\t }\n\t\n\t // Force an array if not already something iterable\n\t if (typeof obj !== 'object') {\n\t /*eslint no-param-reassign:0*/\n\t obj = [obj];\n\t }\n\t\n\t if (isArray(obj)) {\n\t // Iterate over array values\n\t for (var i = 0, l = obj.length; i < l; i++) {\n\t fn.call(null, obj[i], i, obj);\n\t }\n\t } else {\n\t // Iterate over object keys\n\t for (var key in obj) {\n\t if (Object.prototype.hasOwnProperty.call(obj, key)) {\n\t fn.call(null, obj[key], key, obj);\n\t }\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * Accepts varargs expecting each argument to be an object, then\n\t * immutably merges the properties of each object and returns result.\n\t *\n\t * When multiple objects contain the same key the later object in\n\t * the arguments list will take precedence.\n\t *\n\t * Example:\n\t *\n\t * ```js\n\t * var result = merge({foo: 123}, {foo: 456});\n\t * console.log(result.foo); // outputs 456\n\t * ```\n\t *\n\t * @param {Object} obj1 Object to merge\n\t * @returns {Object} Result of all merge properties\n\t */\n\tfunction merge(/* obj1, obj2, obj3, ... */) {\n\t var result = {};\n\t function assignValue(val, key) {\n\t if (isPlainObject(result[key]) && isPlainObject(val)) {\n\t result[key] = merge(result[key], val);\n\t } else if (isPlainObject(val)) {\n\t result[key] = merge({}, val);\n\t } else if (isArray(val)) {\n\t result[key] = val.slice();\n\t } else {\n\t result[key] = val;\n\t }\n\t }\n\t\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t forEach(arguments[i], assignValue);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Extends object a by mutably adding to it the properties of object b.\n\t *\n\t * @param {Object} a The object to be extended\n\t * @param {Object} b The object to copy properties from\n\t * @param {Object} thisArg The object to bind function to\n\t * @return {Object} The resulting value of object a\n\t */\n\tfunction extend(a, b, thisArg) {\n\t forEach(b, function assignValue(val, key) {\n\t if (thisArg && typeof val === 'function') {\n\t a[key] = bind(val, thisArg);\n\t } else {\n\t a[key] = val;\n\t }\n\t });\n\t return a;\n\t}\n\t\n\t/**\n\t * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n\t *\n\t * @param {string} content with BOM\n\t * @return {string} content value without BOM\n\t */\n\tfunction stripBOM(content) {\n\t if (content.charCodeAt(0) === 0xFEFF) {\n\t content = content.slice(1);\n\t }\n\t return content;\n\t}\n\t\n\tmodule.exports = {\n\t isArray: isArray,\n\t isArrayBuffer: isArrayBuffer,\n\t isBuffer: isBuffer,\n\t isFormData: isFormData,\n\t isArrayBufferView: isArrayBufferView,\n\t isString: isString,\n\t isNumber: isNumber,\n\t isObject: isObject,\n\t isPlainObject: isPlainObject,\n\t isUndefined: isUndefined,\n\t isDate: isDate,\n\t isFile: isFile,\n\t isBlob: isBlob,\n\t isFunction: isFunction,\n\t isStream: isStream,\n\t isURLSearchParams: isURLSearchParams,\n\t isStandardBrowserEnv: isStandardBrowserEnv,\n\t forEach: forEach,\n\t merge: merge,\n\t extend: extend,\n\t trim: trim,\n\t stripBOM: stripBOM\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = function bind(fn, thisArg) {\n\t return function wrap() {\n\t var args = new Array(arguments.length);\n\t for (var i = 0; i < args.length; i++) {\n\t args[i] = arguments[i];\n\t }\n\t return fn.apply(thisArg, args);\n\t };\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar buildURL = __webpack_require__(5);\n\tvar InterceptorManager = __webpack_require__(6);\n\tvar dispatchRequest = __webpack_require__(7);\n\tvar mergeConfig = __webpack_require__(22);\n\t\n\t/**\n\t * Create a new instance of Axios\n\t *\n\t * @param {Object} instanceConfig The default config for the instance\n\t */\n\tfunction Axios(instanceConfig) {\n\t this.defaults = instanceConfig;\n\t this.interceptors = {\n\t request: new InterceptorManager(),\n\t response: new InterceptorManager()\n\t };\n\t}\n\t\n\t/**\n\t * Dispatch a request\n\t *\n\t * @param {Object} config The config specific for this request (merged with this.defaults)\n\t */\n\tAxios.prototype.request = function request(config) {\n\t /*eslint no-param-reassign:0*/\n\t // Allow for axios('example/url'[, config]) a la fetch API\n\t if (typeof config === 'string') {\n\t config = arguments[1] || {};\n\t config.url = arguments[0];\n\t } else {\n\t config = config || {};\n\t }\n\t\n\t config = mergeConfig(this.defaults, config);\n\t\n\t // Set config.method\n\t if (config.method) {\n\t config.method = config.method.toLowerCase();\n\t } else if (this.defaults.method) {\n\t config.method = this.defaults.method.toLowerCase();\n\t } else {\n\t config.method = 'get';\n\t }\n\t\n\t // Hook up interceptors middleware\n\t var chain = [dispatchRequest, undefined];\n\t var promise = Promise.resolve(config);\n\t\n\t this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n\t chain.unshift(interceptor.fulfilled, interceptor.rejected);\n\t });\n\t\n\t this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n\t chain.push(interceptor.fulfilled, interceptor.rejected);\n\t });\n\t\n\t while (chain.length) {\n\t promise = promise.then(chain.shift(), chain.shift());\n\t }\n\t\n\t return promise;\n\t};\n\t\n\tAxios.prototype.getUri = function getUri(config) {\n\t config = mergeConfig(this.defaults, config);\n\t return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n\t};\n\t\n\t// Provide aliases for supported request methods\n\tutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n\t /*eslint func-names:0*/\n\t Axios.prototype[method] = function(url, config) {\n\t return this.request(mergeConfig(config || {}, {\n\t method: method,\n\t url: url,\n\t data: (config || {}).data\n\t }));\n\t };\n\t});\n\t\n\tutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n\t /*eslint func-names:0*/\n\t Axios.prototype[method] = function(url, data, config) {\n\t return this.request(mergeConfig(config || {}, {\n\t method: method,\n\t url: url,\n\t data: data\n\t }));\n\t };\n\t});\n\t\n\tmodule.exports = Axios;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tfunction encode(val) {\n\t return encodeURIComponent(val).\n\t replace(/%3A/gi, ':').\n\t replace(/%24/g, '$').\n\t replace(/%2C/gi, ',').\n\t replace(/%20/g, '+').\n\t replace(/%5B/gi, '[').\n\t replace(/%5D/gi, ']');\n\t}\n\t\n\t/**\n\t * Build a URL by appending params to the end\n\t *\n\t * @param {string} url The base of the url (e.g., http://www.google.com)\n\t * @param {object} [params] The params to be appended\n\t * @returns {string} The formatted url\n\t */\n\tmodule.exports = function buildURL(url, params, paramsSerializer) {\n\t /*eslint no-param-reassign:0*/\n\t if (!params) {\n\t return url;\n\t }\n\t\n\t var serializedParams;\n\t if (paramsSerializer) {\n\t serializedParams = paramsSerializer(params);\n\t } else if (utils.isURLSearchParams(params)) {\n\t serializedParams = params.toString();\n\t } else {\n\t var parts = [];\n\t\n\t utils.forEach(params, function serialize(val, key) {\n\t if (val === null || typeof val === 'undefined') {\n\t return;\n\t }\n\t\n\t if (utils.isArray(val)) {\n\t key = key + '[]';\n\t } else {\n\t val = [val];\n\t }\n\t\n\t utils.forEach(val, function parseValue(v) {\n\t if (utils.isDate(v)) {\n\t v = v.toISOString();\n\t } else if (utils.isObject(v)) {\n\t v = JSON.stringify(v);\n\t }\n\t parts.push(encode(key) + '=' + encode(v));\n\t });\n\t });\n\t\n\t serializedParams = parts.join('&');\n\t }\n\t\n\t if (serializedParams) {\n\t var hashmarkIndex = url.indexOf('#');\n\t if (hashmarkIndex !== -1) {\n\t url = url.slice(0, hashmarkIndex);\n\t }\n\t\n\t url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n\t }\n\t\n\t return url;\n\t};\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tfunction InterceptorManager() {\n\t this.handlers = [];\n\t}\n\t\n\t/**\n\t * Add a new interceptor to the stack\n\t *\n\t * @param {Function} fulfilled The function to handle `then` for a `Promise`\n\t * @param {Function} rejected The function to handle `reject` for a `Promise`\n\t *\n\t * @return {Number} An ID used to remove interceptor later\n\t */\n\tInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n\t this.handlers.push({\n\t fulfilled: fulfilled,\n\t rejected: rejected\n\t });\n\t return this.handlers.length - 1;\n\t};\n\t\n\t/**\n\t * Remove an interceptor from the stack\n\t *\n\t * @param {Number} id The ID that was returned by `use`\n\t */\n\tInterceptorManager.prototype.eject = function eject(id) {\n\t if (this.handlers[id]) {\n\t this.handlers[id] = null;\n\t }\n\t};\n\t\n\t/**\n\t * Iterate over all the registered interceptors\n\t *\n\t * This method is particularly useful for skipping over any\n\t * interceptors that may have become `null` calling `eject`.\n\t *\n\t * @param {Function} fn The function to call for each interceptor\n\t */\n\tInterceptorManager.prototype.forEach = function forEach(fn) {\n\t utils.forEach(this.handlers, function forEachHandler(h) {\n\t if (h !== null) {\n\t fn(h);\n\t }\n\t });\n\t};\n\t\n\tmodule.exports = InterceptorManager;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar transformData = __webpack_require__(8);\n\tvar isCancel = __webpack_require__(9);\n\tvar defaults = __webpack_require__(10);\n\t\n\t/**\n\t * Throws a `Cancel` if cancellation has been requested.\n\t */\n\tfunction throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}\n\t\n\t/**\n\t * Dispatch a request to the server using the configured adapter.\n\t *\n\t * @param {object} config The config that is to be used for the request\n\t * @returns {Promise} The Promise to be fulfilled\n\t */\n\tmodule.exports = function dispatchRequest(config) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Ensure headers exist\n\t config.headers = config.headers || {};\n\t\n\t // Transform request data\n\t config.data = transformData(\n\t config.data,\n\t config.headers,\n\t config.transformRequest\n\t );\n\t\n\t // Flatten headers\n\t config.headers = utils.merge(\n\t config.headers.common || {},\n\t config.headers[config.method] || {},\n\t config.headers\n\t );\n\t\n\t utils.forEach(\n\t ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n\t function cleanHeaderConfig(method) {\n\t delete config.headers[method];\n\t }\n\t );\n\t\n\t var adapter = config.adapter || defaults.adapter;\n\t\n\t return adapter(config).then(function onAdapterResolution(response) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Transform response data\n\t response.data = transformData(\n\t response.data,\n\t response.headers,\n\t config.transformResponse\n\t );\n\t\n\t return response;\n\t }, function onAdapterRejection(reason) {\n\t if (!isCancel(reason)) {\n\t throwIfCancellationRequested(config);\n\t\n\t // Transform response data\n\t if (reason && reason.response) {\n\t reason.response.data = transformData(\n\t reason.response.data,\n\t reason.response.headers,\n\t config.transformResponse\n\t );\n\t }\n\t }\n\t\n\t return Promise.reject(reason);\n\t });\n\t};\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t/**\n\t * Transform the data for a request or a response\n\t *\n\t * @param {Object|String} data The data to be transformed\n\t * @param {Array} headers The headers for the request or response\n\t * @param {Array|Function} fns A single function or Array of functions\n\t * @returns {*} The resulting transformed data\n\t */\n\tmodule.exports = function transformData(data, headers, fns) {\n\t /*eslint no-param-reassign:0*/\n\t utils.forEach(fns, function transform(fn) {\n\t data = fn(data, headers);\n\t });\n\t\n\t return data;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = function isCancel(value) {\n\t return !!(value && value.__CANCEL__);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar normalizeHeaderName = __webpack_require__(11);\n\t\n\tvar DEFAULT_CONTENT_TYPE = {\n\t 'Content-Type': 'application/x-www-form-urlencoded'\n\t};\n\t\n\tfunction setContentTypeIfUnset(headers, value) {\n\t if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n\t headers['Content-Type'] = value;\n\t }\n\t}\n\t\n\tfunction getDefaultAdapter() {\n\t var adapter;\n\t if (typeof XMLHttpRequest !== 'undefined') {\n\t // For browsers use XHR adapter\n\t adapter = __webpack_require__(12);\n\t } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n\t // For node use HTTP adapter\n\t adapter = __webpack_require__(12);\n\t }\n\t return adapter;\n\t}\n\t\n\tvar defaults = {\n\t adapter: getDefaultAdapter(),\n\t\n\t transformRequest: [function transformRequest(data, headers) {\n\t normalizeHeaderName(headers, 'Accept');\n\t normalizeHeaderName(headers, 'Content-Type');\n\t if (utils.isFormData(data) ||\n\t utils.isArrayBuffer(data) ||\n\t utils.isBuffer(data) ||\n\t utils.isStream(data) ||\n\t utils.isFile(data) ||\n\t utils.isBlob(data)\n\t ) {\n\t return data;\n\t }\n\t if (utils.isArrayBufferView(data)) {\n\t return data.buffer;\n\t }\n\t if (utils.isURLSearchParams(data)) {\n\t setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n\t return data.toString();\n\t }\n\t if (utils.isObject(data)) {\n\t setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n\t return JSON.stringify(data);\n\t }\n\t return data;\n\t }],\n\t\n\t transformResponse: [function transformResponse(data) {\n\t /*eslint no-param-reassign:0*/\n\t if (typeof data === 'string') {\n\t try {\n\t data = JSON.parse(data);\n\t } catch (e) { /* Ignore */ }\n\t }\n\t return data;\n\t }],\n\t\n\t /**\n\t * A timeout in milliseconds to abort a request. If set to 0 (default) a\n\t * timeout is not created.\n\t */\n\t timeout: 0,\n\t\n\t xsrfCookieName: 'XSRF-TOKEN',\n\t xsrfHeaderName: 'X-XSRF-TOKEN',\n\t\n\t maxContentLength: -1,\n\t maxBodyLength: -1,\n\t\n\t validateStatus: function validateStatus(status) {\n\t return status >= 200 && status < 300;\n\t }\n\t};\n\t\n\tdefaults.headers = {\n\t common: {\n\t 'Accept': 'application/json, text/plain, */*'\n\t }\n\t};\n\t\n\tutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n\t defaults.headers[method] = {};\n\t});\n\t\n\tutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n\t defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n\t});\n\t\n\tmodule.exports = defaults;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n\t utils.forEach(headers, function processHeader(value, name) {\n\t if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n\t headers[normalizedName] = value;\n\t delete headers[name];\n\t }\n\t });\n\t};\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\tvar settle = __webpack_require__(13);\n\tvar cookies = __webpack_require__(16);\n\tvar buildURL = __webpack_require__(5);\n\tvar buildFullPath = __webpack_require__(17);\n\tvar parseHeaders = __webpack_require__(20);\n\tvar isURLSameOrigin = __webpack_require__(21);\n\tvar createError = __webpack_require__(14);\n\t\n\tmodule.exports = function xhrAdapter(config) {\n\t return new Promise(function dispatchXhrRequest(resolve, reject) {\n\t var requestData = config.data;\n\t var requestHeaders = config.headers;\n\t\n\t if (utils.isFormData(requestData)) {\n\t delete requestHeaders['Content-Type']; // Let the browser set it\n\t }\n\t\n\t var request = new XMLHttpRequest();\n\t\n\t // HTTP basic authentication\n\t if (config.auth) {\n\t var username = config.auth.username || '';\n\t var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n\t requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n\t }\n\t\n\t var fullPath = buildFullPath(config.baseURL, config.url);\n\t request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\t\n\t // Set the request timeout in MS\n\t request.timeout = config.timeout;\n\t\n\t // Listen for ready state\n\t request.onreadystatechange = function handleLoad() {\n\t if (!request || request.readyState !== 4) {\n\t return;\n\t }\n\t\n\t // The request errored out and we didn't get a response, this will be\n\t // handled by onerror instead\n\t // With one exception: request that using file: protocol, most browsers\n\t // will return status as 0 even though it's a successful request\n\t if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n\t return;\n\t }\n\t\n\t // Prepare the response\n\t var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n\t var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n\t var response = {\n\t data: responseData,\n\t status: request.status,\n\t statusText: request.statusText,\n\t headers: responseHeaders,\n\t config: config,\n\t request: request\n\t };\n\t\n\t settle(resolve, reject, response);\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle browser request cancellation (as opposed to a manual cancellation)\n\t request.onabort = function handleAbort() {\n\t if (!request) {\n\t return;\n\t }\n\t\n\t reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle low level network errors\n\t request.onerror = function handleError() {\n\t // Real errors are hidden from us by the browser\n\t // onerror should only fire if it's a network error\n\t reject(createError('Network Error', config, null, request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Handle timeout\n\t request.ontimeout = function handleTimeout() {\n\t var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n\t if (config.timeoutErrorMessage) {\n\t timeoutErrorMessage = config.timeoutErrorMessage;\n\t }\n\t reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n\t request));\n\t\n\t // Clean up request\n\t request = null;\n\t };\n\t\n\t // Add xsrf header\n\t // This is only done if running in a standard browser environment.\n\t // Specifically not if we're in a web worker, or react-native.\n\t if (utils.isStandardBrowserEnv()) {\n\t // Add xsrf header\n\t var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n\t cookies.read(config.xsrfCookieName) :\n\t undefined;\n\t\n\t if (xsrfValue) {\n\t requestHeaders[config.xsrfHeaderName] = xsrfValue;\n\t }\n\t }\n\t\n\t // Add headers to the request\n\t if ('setRequestHeader' in request) {\n\t utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n\t if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n\t // Remove Content-Type if data is undefined\n\t delete requestHeaders[key];\n\t } else {\n\t // Otherwise add header to the request\n\t request.setRequestHeader(key, val);\n\t }\n\t });\n\t }\n\t\n\t // Add withCredentials to request if needed\n\t if (!utils.isUndefined(config.withCredentials)) {\n\t request.withCredentials = !!config.withCredentials;\n\t }\n\t\n\t // Add responseType to request if needed\n\t if (config.responseType) {\n\t try {\n\t request.responseType = config.responseType;\n\t } catch (e) {\n\t // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n\t // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n\t if (config.responseType !== 'json') {\n\t throw e;\n\t }\n\t }\n\t }\n\t\n\t // Handle progress if needed\n\t if (typeof config.onDownloadProgress === 'function') {\n\t request.addEventListener('progress', config.onDownloadProgress);\n\t }\n\t\n\t // Not all browsers support upload events\n\t if (typeof config.onUploadProgress === 'function' && request.upload) {\n\t request.upload.addEventListener('progress', config.onUploadProgress);\n\t }\n\t\n\t if (config.cancelToken) {\n\t // Handle cancellation\n\t config.cancelToken.promise.then(function onCanceled(cancel) {\n\t if (!request) {\n\t return;\n\t }\n\t\n\t request.abort();\n\t reject(cancel);\n\t // Clean up request\n\t request = null;\n\t });\n\t }\n\t\n\t if (!requestData) {\n\t requestData = null;\n\t }\n\t\n\t // Send the request\n\t request.send(requestData);\n\t });\n\t};\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar createError = __webpack_require__(14);\n\t\n\t/**\n\t * Resolve or reject a Promise based on response status.\n\t *\n\t * @param {Function} resolve A function that resolves the promise.\n\t * @param {Function} reject A function that rejects the promise.\n\t * @param {object} response The response.\n\t */\n\tmodule.exports = function settle(resolve, reject, response) {\n\t var validateStatus = response.config.validateStatus;\n\t if (!response.status || !validateStatus || validateStatus(response.status)) {\n\t resolve(response);\n\t } else {\n\t reject(createError(\n\t 'Request failed with status code ' + response.status,\n\t response.config,\n\t null,\n\t response.request,\n\t response\n\t ));\n\t }\n\t};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar enhanceError = __webpack_require__(15);\n\t\n\t/**\n\t * Create an Error with the specified message, config, error code, request and response.\n\t *\n\t * @param {string} message The error message.\n\t * @param {Object} config The config.\n\t * @param {string} [code] The error code (for example, 'ECONNABORTED').\n\t * @param {Object} [request] The request.\n\t * @param {Object} [response] The response.\n\t * @returns {Error} The created error.\n\t */\n\tmodule.exports = function createError(message, config, code, request, response) {\n\t var error = new Error(message);\n\t return enhanceError(error, config, code, request, response);\n\t};\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Update an Error with the specified config, error code, and response.\n\t *\n\t * @param {Error} error The error to update.\n\t * @param {Object} config The config.\n\t * @param {string} [code] The error code (for example, 'ECONNABORTED').\n\t * @param {Object} [request] The request.\n\t * @param {Object} [response] The response.\n\t * @returns {Error} The error.\n\t */\n\tmodule.exports = function enhanceError(error, config, code, request, response) {\n\t error.config = config;\n\t if (code) {\n\t error.code = code;\n\t }\n\t\n\t error.request = request;\n\t error.response = response;\n\t error.isAxiosError = true;\n\t\n\t error.toJSON = function toJSON() {\n\t return {\n\t // Standard\n\t message: this.message,\n\t name: this.name,\n\t // Microsoft\n\t description: this.description,\n\t number: this.number,\n\t // Mozilla\n\t fileName: this.fileName,\n\t lineNumber: this.lineNumber,\n\t columnNumber: this.columnNumber,\n\t stack: this.stack,\n\t // Axios\n\t config: this.config,\n\t code: this.code\n\t };\n\t };\n\t return error;\n\t};\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = (\n\t utils.isStandardBrowserEnv() ?\n\t\n\t // Standard browser envs support document.cookie\n\t (function standardBrowserEnv() {\n\t return {\n\t write: function write(name, value, expires, path, domain, secure) {\n\t var cookie = [];\n\t cookie.push(name + '=' + encodeURIComponent(value));\n\t\n\t if (utils.isNumber(expires)) {\n\t cookie.push('expires=' + new Date(expires).toGMTString());\n\t }\n\t\n\t if (utils.isString(path)) {\n\t cookie.push('path=' + path);\n\t }\n\t\n\t if (utils.isString(domain)) {\n\t cookie.push('domain=' + domain);\n\t }\n\t\n\t if (secure === true) {\n\t cookie.push('secure');\n\t }\n\t\n\t document.cookie = cookie.join('; ');\n\t },\n\t\n\t read: function read(name) {\n\t var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n\t return (match ? decodeURIComponent(match[3]) : null);\n\t },\n\t\n\t remove: function remove(name) {\n\t this.write(name, '', Date.now() - 86400000);\n\t }\n\t };\n\t })() :\n\t\n\t // Non standard browser env (web workers, react-native) lack needed support.\n\t (function nonStandardBrowserEnv() {\n\t return {\n\t write: function write() {},\n\t read: function read() { return null; },\n\t remove: function remove() {}\n\t };\n\t })()\n\t);\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar isAbsoluteURL = __webpack_require__(18);\n\tvar combineURLs = __webpack_require__(19);\n\t\n\t/**\n\t * Creates a new URL by combining the baseURL with the requestedURL,\n\t * only when the requestedURL is not already an absolute URL.\n\t * If the requestURL is absolute, this function returns the requestedURL untouched.\n\t *\n\t * @param {string} baseURL The base URL\n\t * @param {string} requestedURL Absolute or relative URL to combine\n\t * @returns {string} The combined full path\n\t */\n\tmodule.exports = function buildFullPath(baseURL, requestedURL) {\n\t if (baseURL && !isAbsoluteURL(requestedURL)) {\n\t return combineURLs(baseURL, requestedURL);\n\t }\n\t return requestedURL;\n\t};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Determines whether the specified URL is absolute\n\t *\n\t * @param {string} url The URL to test\n\t * @returns {boolean} True if the specified URL is absolute, otherwise false\n\t */\n\tmodule.exports = function isAbsoluteURL(url) {\n\t // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n\t // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n\t // by any combination of letters, digits, plus, period, or hyphen.\n\t return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n\t};\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Creates a new URL by combining the specified URLs\n\t *\n\t * @param {string} baseURL The base URL\n\t * @param {string} relativeURL The relative URL\n\t * @returns {string} The combined URL\n\t */\n\tmodule.exports = function combineURLs(baseURL, relativeURL) {\n\t return relativeURL\n\t ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n\t : baseURL;\n\t};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t// Headers whose duplicates are ignored by node\n\t// c.f. https://nodejs.org/api/http.html#http_message_headers\n\tvar ignoreDuplicateOf = [\n\t 'age', 'authorization', 'content-length', 'content-type', 'etag',\n\t 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n\t 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n\t 'referer', 'retry-after', 'user-agent'\n\t];\n\t\n\t/**\n\t * Parse headers into an object\n\t *\n\t * ```\n\t * Date: Wed, 27 Aug 2014 08:58:49 GMT\n\t * Content-Type: application/json\n\t * Connection: keep-alive\n\t * Transfer-Encoding: chunked\n\t * ```\n\t *\n\t * @param {String} headers Headers needing to be parsed\n\t * @returns {Object} Headers parsed into an object\n\t */\n\tmodule.exports = function parseHeaders(headers) {\n\t var parsed = {};\n\t var key;\n\t var val;\n\t var i;\n\t\n\t if (!headers) { return parsed; }\n\t\n\t utils.forEach(headers.split('\\n'), function parser(line) {\n\t i = line.indexOf(':');\n\t key = utils.trim(line.substr(0, i)).toLowerCase();\n\t val = utils.trim(line.substr(i + 1));\n\t\n\t if (key) {\n\t if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n\t return;\n\t }\n\t if (key === 'set-cookie') {\n\t parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n\t } else {\n\t parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n\t }\n\t }\n\t });\n\t\n\t return parsed;\n\t};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\tmodule.exports = (\n\t utils.isStandardBrowserEnv() ?\n\t\n\t // Standard browser envs have full support of the APIs needed to test\n\t // whether the request URL is of the same origin as current location.\n\t (function standardBrowserEnv() {\n\t var msie = /(msie|trident)/i.test(navigator.userAgent);\n\t var urlParsingNode = document.createElement('a');\n\t var originURL;\n\t\n\t /**\n\t * Parse a URL to discover it's components\n\t *\n\t * @param {String} url The URL to be parsed\n\t * @returns {Object}\n\t */\n\t function resolveURL(url) {\n\t var href = url;\n\t\n\t if (msie) {\n\t // IE needs attribute set twice to normalize properties\n\t urlParsingNode.setAttribute('href', href);\n\t href = urlParsingNode.href;\n\t }\n\t\n\t urlParsingNode.setAttribute('href', href);\n\t\n\t // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n\t return {\n\t href: urlParsingNode.href,\n\t protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n\t host: urlParsingNode.host,\n\t search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n\t hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n\t hostname: urlParsingNode.hostname,\n\t port: urlParsingNode.port,\n\t pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n\t urlParsingNode.pathname :\n\t '/' + urlParsingNode.pathname\n\t };\n\t }\n\t\n\t originURL = resolveURL(window.location.href);\n\t\n\t /**\n\t * Determine if a URL shares the same origin as the current location\n\t *\n\t * @param {String} requestURL The URL to test\n\t * @returns {boolean} True if URL shares the same origin, otherwise false\n\t */\n\t return function isURLSameOrigin(requestURL) {\n\t var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n\t return (parsed.protocol === originURL.protocol &&\n\t parsed.host === originURL.host);\n\t };\n\t })() :\n\t\n\t // Non standard browser envs (web workers, react-native) lack needed support.\n\t (function nonStandardBrowserEnv() {\n\t return function isURLSameOrigin() {\n\t return true;\n\t };\n\t })()\n\t);\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar utils = __webpack_require__(2);\n\t\n\t/**\n\t * Config-specific merge-function which creates a new config-object\n\t * by merging two configuration objects together.\n\t *\n\t * @param {Object} config1\n\t * @param {Object} config2\n\t * @returns {Object} New object resulting from merging config2 to config1\n\t */\n\tmodule.exports = function mergeConfig(config1, config2) {\n\t // eslint-disable-next-line no-param-reassign\n\t config2 = config2 || {};\n\t var config = {};\n\t\n\t var valueFromConfig2Keys = ['url', 'method', 'data'];\n\t var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n\t var defaultToConfig2Keys = [\n\t 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n\t 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n\t 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n\t 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n\t 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n\t ];\n\t var directMergeKeys = ['validateStatus'];\n\t\n\t function getMergedValue(target, source) {\n\t if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n\t return utils.merge(target, source);\n\t } else if (utils.isPlainObject(source)) {\n\t return utils.merge({}, source);\n\t } else if (utils.isArray(source)) {\n\t return source.slice();\n\t }\n\t return source;\n\t }\n\t\n\t function mergeDeepProperties(prop) {\n\t if (!utils.isUndefined(config2[prop])) {\n\t config[prop] = getMergedValue(config1[prop], config2[prop]);\n\t } else if (!utils.isUndefined(config1[prop])) {\n\t config[prop] = getMergedValue(undefined, config1[prop]);\n\t }\n\t }\n\t\n\t utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n\t if (!utils.isUndefined(config2[prop])) {\n\t config[prop] = getMergedValue(undefined, config2[prop]);\n\t }\n\t });\n\t\n\t utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\t\n\t utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n\t if (!utils.isUndefined(config2[prop])) {\n\t config[prop] = getMergedValue(undefined, config2[prop]);\n\t } else if (!utils.isUndefined(config1[prop])) {\n\t config[prop] = getMergedValue(undefined, config1[prop]);\n\t }\n\t });\n\t\n\t utils.forEach(directMergeKeys, function merge(prop) {\n\t if (prop in config2) {\n\t config[prop] = getMergedValue(config1[prop], config2[prop]);\n\t } else if (prop in config1) {\n\t config[prop] = getMergedValue(undefined, config1[prop]);\n\t }\n\t });\n\t\n\t var axiosKeys = valueFromConfig2Keys\n\t .concat(mergeDeepPropertiesKeys)\n\t .concat(defaultToConfig2Keys)\n\t .concat(directMergeKeys);\n\t\n\t var otherKeys = Object\n\t .keys(config1)\n\t .concat(Object.keys(config2))\n\t .filter(function filterAxiosKeys(key) {\n\t return axiosKeys.indexOf(key) === -1;\n\t });\n\t\n\t utils.forEach(otherKeys, mergeDeepProperties);\n\t\n\t return config;\n\t};\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * A `Cancel` is an object that is thrown when an operation is canceled.\n\t *\n\t * @class\n\t * @param {string=} message The message.\n\t */\n\tfunction Cancel(message) {\n\t this.message = message;\n\t}\n\t\n\tCancel.prototype.toString = function toString() {\n\t return 'Cancel' + (this.message ? ': ' + this.message : '');\n\t};\n\t\n\tCancel.prototype.__CANCEL__ = true;\n\t\n\tmodule.exports = Cancel;\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar Cancel = __webpack_require__(23);\n\t\n\t/**\n\t * A `CancelToken` is an object that can be used to request cancellation of an operation.\n\t *\n\t * @class\n\t * @param {Function} executor The executor function.\n\t */\n\tfunction CancelToken(executor) {\n\t if (typeof executor !== 'function') {\n\t throw new TypeError('executor must be a function.');\n\t }\n\t\n\t var resolvePromise;\n\t this.promise = new Promise(function promiseExecutor(resolve) {\n\t resolvePromise = resolve;\n\t });\n\t\n\t var token = this;\n\t executor(function cancel(message) {\n\t if (token.reason) {\n\t // Cancellation has already been requested\n\t return;\n\t }\n\t\n\t token.reason = new Cancel(message);\n\t resolvePromise(token.reason);\n\t });\n\t}\n\t\n\t/**\n\t * Throws a `Cancel` if cancellation has been requested.\n\t */\n\tCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n\t if (this.reason) {\n\t throw this.reason;\n\t }\n\t};\n\t\n\t/**\n\t * Returns an object that contains a new `CancelToken` and a function that, when called,\n\t * cancels the `CancelToken`.\n\t */\n\tCancelToken.source = function source() {\n\t var cancel;\n\t var token = new CancelToken(function executor(c) {\n\t cancel = c;\n\t });\n\t return {\n\t token: token,\n\t cancel: cancel\n\t };\n\t};\n\t\n\tmodule.exports = CancelToken;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Syntactic sugar for invoking a function and expanding an array for arguments.\n\t *\n\t * Common use case would be to use `Function.prototype.apply`.\n\t *\n\t * ```js\n\t * function f(x, y, z) {}\n\t * var args = [1, 2, 3];\n\t * f.apply(null, args);\n\t * ```\n\t *\n\t * With `spread` this example can be re-written.\n\t *\n\t * ```js\n\t * spread(function(x, y, z) {})([1, 2, 3]);\n\t * ```\n\t *\n\t * @param {Function} callback\n\t * @returns {Function}\n\t */\n\tmodule.exports = function spread(callback) {\n\t return function wrap(arr) {\n\t return callback.apply(null, arr);\n\t };\n\t};\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\t/**\n\t * Determines whether the payload is an error thrown by Axios\n\t *\n\t * @param {*} payload The value to test\n\t * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n\t */\n\tmodule.exports = function isAxiosError(payload) {\n\t return (typeof payload === 'object') && (payload.isAxiosError === true);\n\t};\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// axios.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 081842adca0968bb3270","module.exports = require('./lib/axios');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./index.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/axios.js\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/utils.js\n// module id = 2\n// module chunks = 0","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/bind.js\n// module id = 3\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/Axios.js\n// module id = 4\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/buildURL.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/InterceptorManager.js\n// module id = 6\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/dispatchRequest.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/transformData.js\n// module id = 8\n// module chunks = 0","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/isCancel.js\n// module id = 9\n// module chunks = 0","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/normalizeHeaderName.js\n// module id = 11\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/adapters/xhr.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/settle.js\n// module id = 13\n// module chunks = 0","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/createError.js\n// module id = 14\n// module chunks = 0","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/enhanceError.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/cookies.js\n// module id = 16\n// module chunks = 0","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/buildFullPath.js\n// module id = 17\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAbsoluteURL.js\n// module id = 18\n// module chunks = 0","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/combineURLs.js\n// module id = 19\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/parseHeaders.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isURLSameOrigin.js\n// module id = 21\n// module chunks = 0","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/core/mergeConfig.js\n// module id = 22\n// module chunks = 0","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/Cancel.js\n// module id = 23\n// module chunks = 0","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/cancel/CancelToken.js\n// module id = 24\n// module chunks = 0","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/spread.js\n// module id = 25\n// module chunks = 0","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/helpers/isAxiosError.js\n// module id = 26\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000..c843f6a
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,14 @@
+# axios examples
+
+To run the examples:
+
+1. `git clone https://github.com/axios/axios.git`
+2. `cd axios`
+3. `npm install`
+4. `grunt build`
+5. `npm run examples`
+6. [http://localhost:3000](http://localhost:3000)
+
+Or use Gitpod, a free dev environment for GitHub:
+
+[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/master/examples/server.js)
diff --git a/examples/all/index.html b/examples/all/index.html
new file mode 100644
index 0000000..caaafdc
--- /dev/null
+++ b/examples/all/index.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html>
+ <head>
+ <title>axios - all example</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>axios.all</h1>
+
+ <div>
+ <h3>User</h3>
+ <div class="row">
+ <img id="useravatar" src="" class="col-md-1"/>
+ <div class="col-md-3">
+ <strong id="username"></strong>
+ </div>
+ </div>
+ <hr/>
+ <h3>Orgs</h3>
+ <ul id="orgs" class="list-unstyled"></ul>
+ </div>
+
+ <script src="/axios.min.js"></script>
+ <script>
+ axios.all([
+ axios.get('https://api.github.com/users/mzabriskie'),
+ axios.get('https://api.github.com/users/mzabriskie/orgs')
+ ]).then(axios.spread(function (user, orgs) {
+ document.getElementById('useravatar').src = user.data.avatar_url;
+ document.getElementById('username').innerHTML = user.data.name;
+ document.getElementById('orgs').innerHTML = orgs.data.map(function (org) {
+ return (
+ '<li class="row">' +
+ '<img src="' + org.avatar_url + '" class="col-md-1"/>' +
+ '<div class="col-md-3">' +
+ '<strong>' + org.login + '</strong>' +
+ '</div>' +
+ '</li>'
+ );
+ }).join('');
+ }));
+ </script>
+ </body>
+</html>
diff --git a/examples/amd/index.html b/examples/amd/index.html
new file mode 100644
index 0000000..1b10d2b
--- /dev/null
+++ b/examples/amd/index.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+ <head>
+ <title>AMD</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>AMD</h1>
+
+ <div>
+ <h3>User</h3>
+ <div class="row">
+ <img id="useravatar" src="" class="col-md-1"/>
+ <div class="col-md-3">
+ <strong id="username"></strong>
+ </div>
+ </div>
+ </div>
+
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.16/require.min.js"></script>
+ <script>
+ requirejs.config({
+ paths: {
+ axios: '/axios.min'
+ }
+ });
+
+ requirejs(['axios'], function (axios) {
+ axios.get('https://api.github.com/users/mzabriskie')
+ .then(function (user) {
+ document.getElementById('useravatar').src = user.data.avatar_url;
+ document.getElementById('username').innerHTML = user.data.name;
+ });
+ });
+ </script>
+ </body>
+</html>
diff --git a/examples/get/index.html b/examples/get/index.html
new file mode 100644
index 0000000..8643323
--- /dev/null
+++ b/examples/get/index.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+ <head>
+ <title>axios - get example</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>axios.get</h1>
+ <ul id="people" class="list-unstyled"></ul>
+
+ <script src="/axios.min.js"></script>
+ <script>
+ axios.get('/get/server')
+ .then(function (response) {
+ document.getElementById('people').innerHTML = response.data.map(function (person) {
+ return (
+ '<li class="row">' +
+ '<img src="https://avatars.githubusercontent.com/u/' + person.avatar + '?s=50" class="col-md-1"/>' +
+ '<div class="col-md-3">' +
+ '<strong>' + person.name + '</strong>' +
+ '<div>Github: <a href="https://github.com/' + person.github + '" target="_blank">' + person.github + '</a></div>' +
+ '<div>Twitter: <a href="https://twitter.com/' + person.twitter + '" target="_blank">' + person.twitter + '</a></div>' +
+ '</div>' +
+ '</li><br/>'
+ );
+ }).join('');
+ })
+ .catch(function (err) {
+ document.getElementById('people').innerHTML = '<li class="text-danger">' + err.message + '</li>';
+ });
+ </script>
+ </body>
+</html>
diff --git a/examples/get/server.js b/examples/get/server.js
new file mode 100644
index 0000000..2ad28fa
--- /dev/null
+++ b/examples/get/server.js
@@ -0,0 +1,34 @@
+var people = [
+ {
+ "name": "Matt Zabriskie",
+ "github": "mzabriskie",
+ "twitter": "mzabriskie",
+ "avatar": "199035"
+ },
+ {
+ "name": "Ryan Florence",
+ "github": "rpflorence",
+ "twitter": "ryanflorence",
+ "avatar": "100200"
+ },
+ {
+ "name": "Kent C. Dodds",
+ "github": "kentcdodds",
+ "twitter": "kentcdodds",
+ "avatar": "1500684"
+ },
+ {
+ "name": "Chris Esplin",
+ "github": "deltaepsilon",
+ "twitter": "chrisesplin",
+ "avatar": "878947"
+ }
+];
+
+module.exports = function (req, res) {
+ res.writeHead(200, {
+ 'Content-Type': 'text/json'
+ });
+ res.write(JSON.stringify(people));
+ res.end();
+};
diff --git a/examples/post/index.html b/examples/post/index.html
new file mode 100644
index 0000000..43914a1
--- /dev/null
+++ b/examples/post/index.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+ <head>
+ <title>axios - post example</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>axios.post</h1>
+
+ <form role="form" class="form" onsubmit="return false;">
+ <div class="form-group">
+ <label for="data">JSON</label>
+ <textarea id="data" class="form-control" rows="5"></textarea>
+ </div>
+ <button id="post" type="button" class="btn btn-primary">POST</button>
+ </form>
+
+ <div id="output" class="container"></div>
+
+ <script src="/axios.min.js"></script>
+ <script>
+ (function () {
+ var output = document.getElementById('output');
+ document.getElementById('post').onclick = function () {
+ var data = document.getElementById('data').value;
+
+ axios.post('/post/server', JSON.parse(data))
+ .then(function (res) {
+ output.className = 'container';
+ output.innerHTML = res.data;
+ })
+ .catch(function (err) {
+ output.className = 'container text-danger';
+ output.innerHTML = err.message;
+ });
+ };
+ })();
+ </script>
+ </body>
+</html>
diff --git a/examples/post/server.js b/examples/post/server.js
new file mode 100644
index 0000000..3424426
--- /dev/null
+++ b/examples/post/server.js
@@ -0,0 +1,16 @@
+module.exports = function (req, res) {
+ var data = '';
+
+ req.on('data', function (chunk) {
+ data += chunk;
+ });
+
+ req.on('end', function () {
+ console.log('POST data received');
+ res.writeHead(200, {
+ 'Content-Type': 'text/json'
+ });
+ res.write(JSON.stringify(data));
+ res.end();
+ });
+};
diff --git a/examples/server.js b/examples/server.js
new file mode 100644
index 0000000..dab1c04
--- /dev/null
+++ b/examples/server.js
@@ -0,0 +1,140 @@
+var fs = require('fs');
+var path = require('path');
+var http = require('http');
+var argv = require('minimist')(process.argv.slice(2));
+var server;
+var dirs;
+
+function listDirs(root) {
+ var files = fs.readdirSync(root);
+ var dirs = [];
+
+ for (var i = 0, l = files.length; i < l; i++) {
+ var file = files[i];
+ if (file[0] !== '.') {
+ var stat = fs.statSync(path.join(root, file));
+ if (stat.isDirectory()) {
+ dirs.push(file);
+ }
+ }
+ }
+
+ return dirs;
+}
+
+function getIndexTemplate() {
+ var links = dirs.map(function (dir) {
+ var url = '/' + dir;
+ return '<li onclick="document.location=\'' + url + '\'"><a href="' + url + '">' + url + '</a></li>';
+ });
+
+ return (
+ '<!doctype html>' +
+ '<html>' +
+ '<head>' +
+ '<title>axios examples</title>' +
+ '<style>' +
+ 'body {padding:25px;}' +
+ 'ul {margin:0; padding:0; list-style:none;}' +
+ 'li {padding:5px 10px;}' +
+ 'li:hover {background:#eee; cursor:pointer;}' +
+ 'a {text-decoration:none; color:#0080ff;}' +
+ '</style>' +
+ '<body>' +
+ '<ul>' +
+ links.join('') +
+ '</ul>'
+ );
+}
+
+function sendResponse(res, statusCode, body) {
+ res.writeHead(statusCode);
+ res.write(body);
+ res.end();
+}
+
+function send200(res, body) {
+ sendResponse(res, 200, body || '<h1>OK</h1>');
+}
+
+function send404(res, body) {
+ sendResponse(res, 404, body || '<h1>Not Found</h1>');
+}
+
+function pipeFileToResponse(res, file, type) {
+ if (type) {
+ res.writeHead(200, {
+ 'Content-Type': type
+ });
+ }
+ fs.createReadStream(path.join(__dirname, file)).pipe(res);
+}
+
+
+dirs = listDirs(__dirname);
+
+server = http.createServer(function (req, res) {
+ var url = req.url;
+
+ // Process axios itself
+ if (/axios\.min\.js$/.test(url)) {
+ pipeFileToResponse(res, '../dist/axios.min.js', 'text/javascript');
+ return;
+ }
+ if (/axios\.min\.map$/.test(url)) {
+ pipeFileToResponse(res, '../dist/axios.min.map', 'text/javascript');
+ return;
+ }
+ if (/axios\.amd\.min\.js$/.test(url)) {
+ pipeFileToResponse(res, '../dist/axios.amd.min.js', 'text/javascript');
+ return;
+ }
+ if (/axios\.amd\.min\.map$/.test(url)) {
+ pipeFileToResponse(res, '../dist/axios.amd.min.map', 'text/javascript');
+ return;
+ }
+
+ // Process /
+ if (url === '/' || url === '/index.html') {
+ send200(res, getIndexTemplate());
+ return;
+ }
+
+ // Format request */ -> */index.html
+ if (/\/$/.test(url)) {
+ url += 'index.html';
+ }
+
+ // Format request /get -> /get/index.html
+ var parts = url.split('/');
+ if (dirs.indexOf(parts[parts.length - 1]) > -1) {
+ url += '/index.html';
+ }
+
+ // Process index.html request
+ if (/index\.html$/.test(url)) {
+ if (fs.existsSync(path.join(__dirname, url))) {
+ pipeFileToResponse(res, url, 'text/html');
+ } else {
+ send404(res);
+ }
+ }
+
+ // Process server request
+ else if (new RegExp('(' + dirs.join('|') + ')\/server').test(url)) {
+ if (fs.existsSync(path.join(__dirname, url + '.js'))) {
+ require(path.join(__dirname, url + '.js'))(req, res);
+ } else {
+ send404(res);
+ }
+ }
+ else {
+ send404(res);
+ }
+});
+
+const PORT = argv.p || 3000;
+
+server.listen(PORT);
+
+console.log("Examples running on " + PORT);
diff --git a/examples/transform-response/index.html b/examples/transform-response/index.html
new file mode 100644
index 0000000..36dd26a
--- /dev/null
+++ b/examples/transform-response/index.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html>
+ <head>
+ <title>axios - transform response example</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>transformResponse</h1>
+
+ <div class="row">
+ <img id="useravatar" src="" class="col-md-1"/>
+ <div class="col-md-3">
+ <strong id="username"></strong><br/>
+ Created: <span id="created"></span><br/>
+ Updated: <span id="updated"></span>
+ </div>
+ </div>
+
+ <script src="/axios.min.js"></script>
+ <script>
+ var ISO_8601 = /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})Z/;
+ function formatDate(d) {
+ return (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
+ }
+
+ axios.get('https://api.github.com/users/mzabriskie', {
+ transformResponse: axios.defaults.transformResponse.concat(function (data, headers) {
+ Object.keys(data).forEach(function (k) {
+ if (ISO_8601.test(data[k])) {
+ data[k] = new Date(Date.parse(data[k]));
+ }
+ });
+ return data;
+ })
+ })
+ .then(function (res) {
+ document.getElementById('useravatar').src = res.data.avatar_url;
+ document.getElementById('username').innerHTML = res.data.name;
+ document.getElementById('created').innerHTML = formatDate(res.data.created_at);
+ document.getElementById('updated').innerHTML = formatDate(res.data.updated_at);
+ });
+ </script>
+ </body>
+</html>
diff --git a/examples/upload/index.html b/examples/upload/index.html
new file mode 100644
index 0000000..c26b41f
--- /dev/null
+++ b/examples/upload/index.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<html>
+ <head>
+ <title>axios - file upload example</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ </head>
+ <body class="container">
+ <h1>file upload</h1>
+
+ <form role="form" class="form" onsubmit="return false;">
+ <div class="form-group">
+ <label for="file">File</label>
+ <input id="file" type="file" class="form-control"/>
+ </div>
+ <button id="upload" type="button" class="btn btn-primary">Upload</button>
+ </form>
+
+ <div id="output" class="container"></div>
+
+ <script src="/axios.min.js"></script>
+ <script>
+ (function () {
+ var output = document.getElementById('output');
+ document.getElementById('upload').onclick = function () {
+ var data = new FormData();
+ data.append('foo', 'bar');
+ data.append('file', document.getElementById('file').files[0]);
+
+ var config = {
+ onUploadProgress: function(progressEvent) {
+ var percentCompleted = Math.round( (progressEvent.loaded * 100) / progressEvent.total );
+ }
+ };
+
+ axios.put('/upload/server', data, config)
+ .then(function (res) {
+ output.className = 'container';
+ output.innerHTML = res.data;
+ })
+ .catch(function (err) {
+ output.className = 'container text-danger';
+ output.innerHTML = err.message;
+ });
+ };
+ })();
+ </script>
+ </body>
+</html>
diff --git a/examples/upload/server.js b/examples/upload/server.js
new file mode 100644
index 0000000..e0d2ef3
--- /dev/null
+++ b/examples/upload/server.js
@@ -0,0 +1,13 @@
+module.exports = function (req, res) {
+ var data = '';
+
+ req.on('data', function (chunk) {
+ data += chunk;
+ });
+
+ req.on('end', function () {
+ console.log('File uploaded');
+ res.writeHead(200);
+ res.end();
+ });
+};
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 0000000..c74e93c
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1,161 @@
+export interface AxiosTransformer {
+ (data: any, headers?: any): any;
+}
+
+export interface AxiosAdapter {
+ (config: AxiosRequestConfig): AxiosPromise<any>;
+}
+
+export interface AxiosBasicCredentials {
+ username: string;
+ password: string;
+}
+
+export interface AxiosProxyConfig {
+ host: string;
+ port: number;
+ auth?: {
+ username: string;
+ password:string;
+ };
+ protocol?: string;
+}
+
+export type Method =
+ | 'get' | 'GET'
+ | 'delete' | 'DELETE'
+ | 'head' | 'HEAD'
+ | 'options' | 'OPTIONS'
+ | 'post' | 'POST'
+ | 'put' | 'PUT'
+ | 'patch' | 'PATCH'
+ | 'purge' | 'PURGE'
+ | 'link' | 'LINK'
+ | 'unlink' | 'UNLINK'
+
+export type ResponseType =
+ | 'arraybuffer'
+ | 'blob'
+ | 'document'
+ | 'json'
+ | 'text'
+ | 'stream'
+
+export interface AxiosRequestConfig {
+ url?: string;
+ method?: Method;
+ baseURL?: string;
+ transformRequest?: AxiosTransformer | AxiosTransformer[];
+ transformResponse?: AxiosTransformer | AxiosTransformer[];
+ headers?: any;
+ params?: any;
+ paramsSerializer?: (params: any) => string;
+ data?: any;
+ timeout?: number;
+ timeoutErrorMessage?: string;
+ withCredentials?: boolean;
+ adapter?: AxiosAdapter;
+ auth?: AxiosBasicCredentials;
+ responseType?: ResponseType;
+ xsrfCookieName?: string;
+ xsrfHeaderName?: string;
+ onUploadProgress?: (progressEvent: any) => void;
+ onDownloadProgress?: (progressEvent: any) => void;
+ maxContentLength?: number;
+ validateStatus?: ((status: number) => boolean) | null;
+ maxBodyLength?: number;
+ maxRedirects?: number;
+ socketPath?: string | null;
+ httpAgent?: any;
+ httpsAgent?: any;
+ proxy?: AxiosProxyConfig | false;
+ cancelToken?: CancelToken;
+ decompress?: boolean;
+}
+
+export interface AxiosResponse<T = any> {
+ data: T;
+ status: number;
+ statusText: string;
+ headers: any;
+ config: AxiosRequestConfig;
+ request?: any;
+}
+
+export interface AxiosError<T = any> extends Error {
+ config: AxiosRequestConfig;
+ code?: string;
+ request?: any;
+ response?: AxiosResponse<T>;
+ isAxiosError: boolean;
+ toJSON: () => object;
+}
+
+export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
+}
+
+export interface CancelStatic {
+ new (message?: string): Cancel;
+}
+
+export interface Cancel {
+ message: string;
+}
+
+export interface Canceler {
+ (message?: string): void;
+}
+
+export interface CancelTokenStatic {
+ new (executor: (cancel: Canceler) => void): CancelToken;
+ source(): CancelTokenSource;
+}
+
+export interface CancelToken {
+ promise: Promise<Cancel>;
+ reason?: Cancel;
+ throwIfRequested(): void;
+}
+
+export interface CancelTokenSource {
+ token: CancelToken;
+ cancel: Canceler;
+}
+
+export interface AxiosInterceptorManager<V> {
+ use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
+ eject(id: number): void;
+}
+
+export interface AxiosInstance {
+ (config: AxiosRequestConfig): AxiosPromise;
+ (url: string, config?: AxiosRequestConfig): AxiosPromise;
+ defaults: AxiosRequestConfig;
+ interceptors: {
+ request: AxiosInterceptorManager<AxiosRequestConfig>;
+ response: AxiosInterceptorManager<AxiosResponse>;
+ };
+ getUri(config?: AxiosRequestConfig): string;
+ request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
+ get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
+ delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
+ head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
+ options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
+ post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
+ put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
+ patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
+}
+
+export interface AxiosStatic extends AxiosInstance {
+ create(config?: AxiosRequestConfig): AxiosInstance;
+ Cancel: CancelStatic;
+ CancelToken: CancelTokenStatic;
+ isCancel(value: any): boolean;
+ all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
+ spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
+ isAxiosError(payload: any): payload is AxiosError;
+}
+
+declare const axios: AxiosStatic;
+
+export default axios;
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..79dfd09
--- /dev/null
+++ b/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/axios'); \ No newline at end of file
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644
index 0000000..5525421
--- /dev/null
+++ b/karma.conf.js
@@ -0,0 +1,246 @@
+// Karma configuration
+// Generated on Fri Aug 15 2014 23:11:13 GMT-0500 (CDT)
+
+var webpack = require('webpack');
+
+function createCustomLauncher(browser, version, platform) {
+ return {
+ base: 'SauceLabs',
+ browserName: browser,
+ version: version,
+ platform: platform
+ };
+}
+
+module.exports = function(config) {
+ var customLaunchers = {};
+ var browsers = [];
+
+ if (process.env.SAUCE_USERNAME || process.env.SAUCE_ACCESS_KEY) {
+ customLaunchers = {};
+
+ var runAll = true;
+ var options = [
+ 'SAUCE_CHROME',
+ 'SAUCE_FIREFOX',
+ 'SAUCE_SAFARI',
+ 'SAUCE_OPERA',
+ 'SAUCE_IE',
+ 'SAUCE_EDGE',
+ 'SAUCE_IOS',
+ 'SAUCE_ANDROID'
+ ];
+
+ options.forEach(function (opt) {
+ if (process.env[opt]) {
+ runAll = false;
+ }
+ });
+
+ // Chrome
+ if (runAll || process.env.SAUCE_CHROME) {
+ customLaunchers.SL_Chrome = createCustomLauncher('chrome');
+ // customLaunchers.SL_ChromeDev = createCustomLauncher('chrome', 'dev');
+ // customLaunchers.SL_ChromeBeta = createCustomLauncher('chrome', 'beta');
+ }
+
+ // Firefox
+ if (runAll || process.env.SAUCE_FIREFOX) {
+ customLaunchers.SL_Firefox = createCustomLauncher('firefox');
+ // customLaunchers.SL_FirefoxDev = createCustomLauncher('firefox', 'dev');
+ // customLaunchers.SL_FirefoxBeta = createCustomLauncher('firefox', 'beta');
+ }
+
+ // Safari
+ if (runAll || process.env.SAUCE_SAFARI) {
+ // customLaunchers.SL_Safari7 = createCustomLauncher('safari', 7);
+ // customLaunchers.SL_Safari8 = createCustomLauncher('safari', 8);
+
+ customLaunchers.SL_Safari9 = createCustomLauncher(
+ "safari",
+ 9.0,
+ "OS X 10.11"
+ );
+ customLaunchers.SL_Safari10 = createCustomLauncher(
+ "safari",
+ "10.1",
+ "macOS 10.12"
+ );
+ customLaunchers.SL_Safari11 = createCustomLauncher(
+ "safari",
+ "11.1",
+ "macOS 10.13"
+ );
+ }
+
+ // Opera
+ if (runAll || process.env.SAUCE_OPERA) {
+ // TODO The available versions of Opera are too old and lack basic APIs
+ // customLaunchers.SL_Opera11 = createCustomLauncher('opera', 11, 'Windows XP');
+ // customLaunchers.SL_Opera12 = createCustomLauncher('opera', 12, 'Windows 7');
+ }
+
+ // IE
+ if (runAll || process.env.SAUCE_IE) {
+ customLaunchers.SL_IE11 = createCustomLauncher('internet explorer', 11, 'Windows 8.1');
+ }
+
+ // Edge
+ if (runAll || process.env.SAUCE_EDGE) {
+ customLaunchers.SL_Edge = createCustomLauncher('microsoftedge', null, 'Windows 10');
+ }
+
+ // IOS
+ if (runAll || process.env.SAUCE_IOS) {
+ // TODO IOS7 capture always timesout
+ // customLaunchers.SL_IOS7 = createCustomLauncher('iphone', '7.1', 'OS X 10.10');
+ // TODO Mobile browsers are causing failures, possibly from too many concurrent VMs
+ // customLaunchers.SL_IOS8 = createCustomLauncher('iphone', '8.4', 'OS X 10.10');
+ // customLaunchers.SL_IOS9 = createCustomLauncher('iphone', '9.2', 'OS X 10.10');
+ }
+
+ // Android
+ if (runAll || process.env.SAUCE_ANDROID) {
+ // TODO Mobile browsers are causing failures, possibly from too many concurrent VMs
+ // customLaunchers.SL_Android4 = createCustomLauncher('android', '4.4', 'Linux');
+ // customLaunchers.SL_Android5 = createCustomLauncher('android', '5.1', 'Linux');
+ }
+
+ browsers = Object.keys(customLaunchers);
+ } else if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
+ console.log(
+ 'Cannot run on Sauce Labs as encrypted environment variables are not available to PRs. ' +
+ 'Running on Travis.'
+ );
+ browsers = ['Firefox'];
+ } else {
+ console.log('Running locally since SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are not set.');
+ browsers = ['Firefox', 'Chrome', 'Safari', 'Opera'];
+ }
+
+ config.set({
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine-ajax', 'jasmine', 'sinon'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'test/specs/__helpers.js',
+ 'test/specs/**/*.spec.js',
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ 'test/specs/__helpers.js': ['webpack', 'sourcemap'],
+ 'test/specs/**/*.spec.js': ['webpack', 'sourcemap']
+ },
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ // Disable code coverage, as it's breaking CI:
+ // reporters: ['dots', 'coverage', 'saucelabs'],
+ reporters: ['dots', 'saucelabs'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
+ captureTimeout: 4 * 60 * 1000,
+ browserDisconnectTimeout: 10000,
+ browserDisconnectTolerance: 1,
+ browserNoActivityTimeout: 4 * 60 * 1000,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: browsers,
+
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: false,
+
+ // Webpack config
+ webpack: {
+ cache: true,
+ devtool: 'inline-source-map',
+ // Disable code coverage, as it's breaking CI
+ // module: {
+ // postLoaders: [
+ // {
+ // test: /\.js$/,
+ // exclude: /(node_modules|test)/,
+ // loader: 'istanbul-instrumenter'
+ // }
+ // ]
+ // },
+ externals: [
+ {
+ './adapters/http': 'var undefined'
+ }
+ ],
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify('test')
+ })
+ ]
+ },
+
+ webpackServer: {
+ stats: {
+ colors: true
+ }
+ },
+
+
+ // Coverage reporting
+ coverageReporter: {
+ type: 'lcov',
+ dir: 'coverage/',
+ subdir: '.'
+ },
+
+
+ // SauceLabs config
+ sauceLabs: {
+ recordScreenshots: false,
+ connectOptions: {
+ // port: 5757,
+ logfile: 'sauce_connect.log'
+ },
+ public: 'public'
+ },
+
+ customLaunchers: customLaunchers
+ });
+};
diff --git a/lib/adapters/README.md b/lib/adapters/README.md
new file mode 100644
index 0000000..68f1118
--- /dev/null
+++ b/lib/adapters/README.md
@@ -0,0 +1,37 @@
+# axios // adapters
+
+The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
+
+## Example
+
+```js
+var settle = require('./../core/settle');
+
+module.exports = function myAdapter(config) {
+ // At this point:
+ // - config has been merged with defaults
+ // - request transformers have already run
+ // - request interceptors have already run
+
+ // Make the request using config provided
+ // Upon response settle the Promise
+
+ return new Promise(function(resolve, reject) {
+
+ var response = {
+ data: responseData,
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders,
+ config: config,
+ request: request
+ };
+
+ settle(resolve, reject, response);
+
+ // From here:
+ // - response transformers will run
+ // - response interceptors will run
+ });
+}
+```
diff --git a/lib/adapters/http.js b/lib/adapters/http.js
new file mode 100755
index 0000000..f32241f
--- /dev/null
+++ b/lib/adapters/http.js
@@ -0,0 +1,303 @@
+'use strict';
+
+var utils = require('./../utils');
+var settle = require('./../core/settle');
+var buildFullPath = require('../core/buildFullPath');
+var buildURL = require('./../helpers/buildURL');
+var http = require('http');
+var https = require('https');
+var httpFollow = require('follow-redirects').http;
+var httpsFollow = require('follow-redirects').https;
+var url = require('url');
+var zlib = require('zlib');
+var pkg = require('./../../package.json');
+var createError = require('../core/createError');
+var enhanceError = require('../core/enhanceError');
+
+var isHttps = /https:?/;
+
+/**
+ *
+ * @param {http.ClientRequestArgs} options
+ * @param {AxiosProxyConfig} proxy
+ * @param {string} location
+ */
+function setProxy(options, proxy, location) {
+ options.hostname = proxy.host;
+ options.host = proxy.host;
+ options.port = proxy.port;
+ options.path = location;
+
+ // 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;
+ }
+
+ // 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);
+ };
+}
+
+/*eslint consistent-return:0*/
+module.exports = function httpAdapter(config) {
+ return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
+ var resolve = function resolve(value) {
+ resolvePromise(value);
+ };
+ var reject = function reject(value) {
+ rejectPromise(value);
+ };
+ var data = config.data;
+ var headers = config.headers;
+
+ // Set User-Agent (required by some servers)
+ // Only set header if it hasn't been set in config
+ // See https://github.com/axios/axios/issues/69
+ if (!headers['User-Agent'] && !headers['user-agent']) {
+ headers['User-Agent'] = 'axios/' + pkg.version;
+ }
+
+ if (data && !utils.isStream(data)) {
+ if (Buffer.isBuffer(data)) {
+ // Nothing to do...
+ } else if (utils.isArrayBuffer(data)) {
+ data = Buffer.from(new Uint8Array(data));
+ } else if (utils.isString(data)) {
+ data = Buffer.from(data, 'utf-8');
+ } else {
+ return reject(createError(
+ 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
+ config
+ ));
+ }
+
+ // Add Content-Length header if data exists
+ headers['Content-Length'] = data.length;
+ }
+
+ // HTTP basic authentication
+ var auth = undefined;
+ if (config.auth) {
+ var username = config.auth.username || '';
+ var password = config.auth.password || '';
+ auth = username + ':' + password;
+ }
+
+ // Parse url
+ var fullPath = buildFullPath(config.baseURL, config.url);
+ var parsed = url.parse(fullPath);
+ var protocol = parsed.protocol || 'http:';
+
+ if (!auth && parsed.auth) {
+ var urlAuth = parsed.auth.split(':');
+ var urlUsername = urlAuth[0] || '';
+ var urlPassword = urlAuth[1] || '';
+ auth = urlUsername + ':' + urlPassword;
+ }
+
+ if (auth) {
+ delete headers.Authorization;
+ }
+
+ var isHttpsRequest = isHttps.test(protocol);
+ var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
+
+ var options = {
+ path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
+ method: config.method.toUpperCase(),
+ headers: headers,
+ agent: agent,
+ agents: { http: config.httpAgent, https: config.httpsAgent },
+ auth: auth
+ };
+
+ if (config.socketPath) {
+ options.socketPath = config.socketPath;
+ } else {
+ options.hostname = parsed.hostname;
+ options.port = parsed.port;
+ }
+
+ 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);
+ if (config.transport) {
+ transport = config.transport;
+ } else if (config.maxRedirects === 0) {
+ transport = isHttpsProxy ? https : http;
+ } else {
+ if (config.maxRedirects) {
+ options.maxRedirects = config.maxRedirects;
+ }
+ transport = isHttpsProxy ? httpsFollow : httpFollow;
+ }
+
+ if (config.maxBodyLength > -1) {
+ options.maxBodyLength = config.maxBodyLength;
+ }
+
+ // Create the request
+ var req = transport.request(options, function handleResponse(res) {
+ if (req.aborted) return;
+
+ // uncompress the response body transparently if required
+ var stream = res;
+
+ // return the last request in case of redirects
+ var lastRequest = res.req || req;
+
+
+ // 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']) {
+ /*eslint default-case:0*/
+ case 'gzip':
+ case 'compress':
+ case 'deflate':
+ // add the unzipper to the body stream processing pipeline
+ stream = stream.pipe(zlib.createUnzip());
+
+ // remove the content-encoding in order to not confuse downstream operations
+ delete res.headers['content-encoding'];
+ break;
+ }
+ }
+
+ var response = {
+ status: res.statusCode,
+ statusText: res.statusMessage,
+ headers: res.headers,
+ config: config,
+ request: lastRequest
+ };
+
+ if (config.responseType === 'stream') {
+ response.data = stream;
+ settle(resolve, reject, response);
+ } else {
+ var responseBuffer = [];
+ stream.on('data', function handleStreamData(chunk) {
+ responseBuffer.push(chunk);
+
+ // make sure the content length is not over the maxContentLength if specified
+ if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
+ stream.destroy();
+ reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
+ config, null, lastRequest));
+ }
+ });
+
+ stream.on('error', function handleStreamError(err) {
+ if (req.aborted) return;
+ reject(enhanceError(err, config, null, lastRequest));
+ });
+
+ stream.on('end', function handleStreamEnd() {
+ var responseData = Buffer.concat(responseBuffer);
+ if (config.responseType !== 'arraybuffer') {
+ responseData = responseData.toString(config.responseEncoding);
+ if (!config.responseEncoding || config.responseEncoding === 'utf8') {
+ responseData = utils.stripBOM(responseData);
+ }
+ }
+
+ response.data = responseData;
+ settle(resolve, reject, response);
+ });
+ }
+ });
+
+ // Handle errors
+ req.on('error', function handleRequestError(err) {
+ if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
+ reject(enhanceError(err, config, null, req));
+ });
+
+ // Handle request timeout
+ if (config.timeout) {
+ // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
+ // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
+ // 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.
+ // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
+ req.setTimeout(config.timeout, function handleRequestTimeout() {
+ req.abort();
+ reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
+ });
+ }
+
+ if (config.cancelToken) {
+ // Handle cancellation
+ config.cancelToken.promise.then(function onCanceled(cancel) {
+ if (req.aborted) return;
+
+ req.abort();
+ reject(cancel);
+ });
+ }
+
+ // Send the request
+ if (utils.isStream(data)) {
+ data.on('error', function handleStreamError(err) {
+ reject(enhanceError(err, config, null, req));
+ }).pipe(req);
+ } else {
+ req.end(data);
+ }
+ });
+};
diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js
new file mode 100644
index 0000000..3027752
--- /dev/null
+++ b/lib/adapters/xhr.js
@@ -0,0 +1,179 @@
+'use strict';
+
+var utils = require('./../utils');
+var settle = require('./../core/settle');
+var cookies = require('./../helpers/cookies');
+var buildURL = require('./../helpers/buildURL');
+var buildFullPath = require('../core/buildFullPath');
+var parseHeaders = require('./../helpers/parseHeaders');
+var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
+var createError = require('../core/createError');
+
+module.exports = function xhrAdapter(config) {
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
+ var requestData = config.data;
+ var requestHeaders = config.headers;
+
+ if (utils.isFormData(requestData)) {
+ delete requestHeaders['Content-Type']; // Let the browser set it
+ }
+
+ var request = new XMLHttpRequest();
+
+ // HTTP basic authentication
+ if (config.auth) {
+ var username = config.auth.username || '';
+ var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
+ }
+
+ var fullPath = buildFullPath(config.baseURL, config.url);
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
+
+ // Set the request timeout in MS
+ request.timeout = config.timeout;
+
+ // Listen for ready state
+ request.onreadystatechange = function handleLoad() {
+ if (!request || request.readyState !== 4) {
+ return;
+ }
+
+ // The request errored out and we didn't get a response, this will be
+ // handled by onerror instead
+ // With one exception: request that using file: protocol, most browsers
+ // will return status as 0 even though it's a successful request
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
+ return;
+ }
+
+ // Prepare the response
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
+ var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
+ var response = {
+ data: responseData,
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders,
+ config: config,
+ request: request
+ };
+
+ settle(resolve, reject, response);
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle browser request cancellation (as opposed to a manual cancellation)
+ request.onabort = function handleAbort() {
+ if (!request) {
+ return;
+ }
+
+ reject(createError('Request aborted', config, 'ECONNABORTED', request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle low level network errors
+ request.onerror = function handleError() {
+ // Real errors are hidden from us by the browser
+ // onerror should only fire if it's a network error
+ reject(createError('Network Error', config, null, request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Handle timeout
+ request.ontimeout = function handleTimeout() {
+ var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
+ if (config.timeoutErrorMessage) {
+ timeoutErrorMessage = config.timeoutErrorMessage;
+ }
+ reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
+ request));
+
+ // Clean up request
+ request = null;
+ };
+
+ // Add xsrf header
+ // This is only done if running in a standard browser environment.
+ // Specifically not if we're in a web worker, or react-native.
+ if (utils.isStandardBrowserEnv()) {
+ // Add xsrf header
+ var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
+ cookies.read(config.xsrfCookieName) :
+ undefined;
+
+ if (xsrfValue) {
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
+ }
+ }
+
+ // Add headers to the request
+ if ('setRequestHeader' in request) {
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
+ // Remove Content-Type if data is undefined
+ delete requestHeaders[key];
+ } else {
+ // Otherwise add header to the request
+ request.setRequestHeader(key, val);
+ }
+ });
+ }
+
+ // Add withCredentials to request if needed
+ if (!utils.isUndefined(config.withCredentials)) {
+ request.withCredentials = !!config.withCredentials;
+ }
+
+ // Add responseType to request if needed
+ if (config.responseType) {
+ try {
+ request.responseType = config.responseType;
+ } catch (e) {
+ // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
+ // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
+ if (config.responseType !== 'json') {
+ throw e;
+ }
+ }
+ }
+
+ // Handle progress if needed
+ if (typeof config.onDownloadProgress === 'function') {
+ request.addEventListener('progress', config.onDownloadProgress);
+ }
+
+ // Not all browsers support upload events
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
+ request.upload.addEventListener('progress', config.onUploadProgress);
+ }
+
+ if (config.cancelToken) {
+ // Handle cancellation
+ config.cancelToken.promise.then(function onCanceled(cancel) {
+ if (!request) {
+ return;
+ }
+
+ request.abort();
+ reject(cancel);
+ // Clean up request
+ request = null;
+ });
+ }
+
+ if (!requestData) {
+ requestData = null;
+ }
+
+ // Send the request
+ request.send(requestData);
+ });
+};
diff --git a/lib/axios.js b/lib/axios.js
new file mode 100644
index 0000000..c6357b0
--- /dev/null
+++ b/lib/axios.js
@@ -0,0 +1,56 @@
+'use strict';
+
+var utils = require('./utils');
+var bind = require('./helpers/bind');
+var Axios = require('./core/Axios');
+var mergeConfig = require('./core/mergeConfig');
+var defaults = require('./defaults');
+
+/**
+ * Create an instance of Axios
+ *
+ * @param {Object} defaultConfig The default config for the instance
+ * @return {Axios} A new instance of Axios
+ */
+function createInstance(defaultConfig) {
+ var context = new Axios(defaultConfig);
+ var instance = bind(Axios.prototype.request, context);
+
+ // Copy axios.prototype to instance
+ utils.extend(instance, Axios.prototype, context);
+
+ // Copy context to instance
+ utils.extend(instance, context);
+
+ return instance;
+}
+
+// Create the default instance to be exported
+var axios = createInstance(defaults);
+
+// Expose Axios class to allow class inheritance
+axios.Axios = Axios;
+
+// Factory for creating new instances
+axios.create = function create(instanceConfig) {
+ return createInstance(mergeConfig(axios.defaults, instanceConfig));
+};
+
+// Expose Cancel & CancelToken
+axios.Cancel = require('./cancel/Cancel');
+axios.CancelToken = require('./cancel/CancelToken');
+axios.isCancel = require('./cancel/isCancel');
+
+// Expose all/spread
+axios.all = function all(promises) {
+ return Promise.all(promises);
+};
+axios.spread = require('./helpers/spread');
+
+// Expose isAxiosError
+axios.isAxiosError = require('./helpers/isAxiosError');
+
+module.exports = axios;
+
+// Allow use of default import syntax in TypeScript
+module.exports.default = axios;
diff --git a/lib/cancel/Cancel.js b/lib/cancel/Cancel.js
new file mode 100644
index 0000000..e0de400
--- /dev/null
+++ b/lib/cancel/Cancel.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/**
+ * A `Cancel` is an object that is thrown when an operation is canceled.
+ *
+ * @class
+ * @param {string=} message The message.
+ */
+function Cancel(message) {
+ this.message = message;
+}
+
+Cancel.prototype.toString = function toString() {
+ return 'Cancel' + (this.message ? ': ' + this.message : '');
+};
+
+Cancel.prototype.__CANCEL__ = true;
+
+module.exports = Cancel;
diff --git a/lib/cancel/CancelToken.js b/lib/cancel/CancelToken.js
new file mode 100644
index 0000000..6b46e66
--- /dev/null
+++ b/lib/cancel/CancelToken.js
@@ -0,0 +1,57 @@
+'use strict';
+
+var Cancel = require('./Cancel');
+
+/**
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
+ *
+ * @class
+ * @param {Function} executor The executor function.
+ */
+function CancelToken(executor) {
+ if (typeof executor !== 'function') {
+ throw new TypeError('executor must be a function.');
+ }
+
+ var resolvePromise;
+ this.promise = new Promise(function promiseExecutor(resolve) {
+ resolvePromise = resolve;
+ });
+
+ var token = this;
+ executor(function cancel(message) {
+ if (token.reason) {
+ // Cancellation has already been requested
+ return;
+ }
+
+ token.reason = new Cancel(message);
+ resolvePromise(token.reason);
+ });
+}
+
+/**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+CancelToken.prototype.throwIfRequested = function throwIfRequested() {
+ if (this.reason) {
+ throw this.reason;
+ }
+};
+
+/**
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
+ * cancels the `CancelToken`.
+ */
+CancelToken.source = function source() {
+ var cancel;
+ var token = new CancelToken(function executor(c) {
+ cancel = c;
+ });
+ return {
+ token: token,
+ cancel: cancel
+ };
+};
+
+module.exports = CancelToken;
diff --git a/lib/cancel/isCancel.js b/lib/cancel/isCancel.js
new file mode 100644
index 0000000..051f3ae
--- /dev/null
+++ b/lib/cancel/isCancel.js
@@ -0,0 +1,5 @@
+'use strict';
+
+module.exports = function isCancel(value) {
+ return !!(value && value.__CANCEL__);
+};
diff --git a/lib/core/Axios.js b/lib/core/Axios.js
new file mode 100644
index 0000000..c28c413
--- /dev/null
+++ b/lib/core/Axios.js
@@ -0,0 +1,95 @@
+'use strict';
+
+var utils = require('./../utils');
+var buildURL = require('../helpers/buildURL');
+var InterceptorManager = require('./InterceptorManager');
+var dispatchRequest = require('./dispatchRequest');
+var mergeConfig = require('./mergeConfig');
+
+/**
+ * Create a new instance of Axios
+ *
+ * @param {Object} instanceConfig The default config for the instance
+ */
+function Axios(instanceConfig) {
+ this.defaults = instanceConfig;
+ this.interceptors = {
+ request: new InterceptorManager(),
+ response: new InterceptorManager()
+ };
+}
+
+/**
+ * Dispatch a request
+ *
+ * @param {Object} config The config specific for this request (merged with this.defaults)
+ */
+Axios.prototype.request = function request(config) {
+ /*eslint no-param-reassign:0*/
+ // Allow for axios('example/url'[, config]) a la fetch API
+ if (typeof config === 'string') {
+ config = arguments[1] || {};
+ config.url = arguments[0];
+ } else {
+ config = config || {};
+ }
+
+ config = mergeConfig(this.defaults, config);
+
+ // Set config.method
+ if (config.method) {
+ config.method = config.method.toLowerCase();
+ } else if (this.defaults.method) {
+ config.method = this.defaults.method.toLowerCase();
+ } else {
+ config.method = 'get';
+ }
+
+ // Hook up interceptors middleware
+ var chain = [dispatchRequest, undefined];
+ var promise = Promise.resolve(config);
+
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
+ chain.unshift(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
+ chain.push(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ while (chain.length) {
+ promise = promise.then(chain.shift(), chain.shift());
+ }
+
+ return promise;
+};
+
+Axios.prototype.getUri = function getUri(config) {
+ config = mergeConfig(this.defaults, config);
+ return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
+};
+
+// Provide aliases for supported request methods
+utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, config) {
+ return this.request(mergeConfig(config || {}, {
+ method: method,
+ url: url,
+ data: (config || {}).data
+ }));
+ };
+});
+
+utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ /*eslint func-names:0*/
+ Axios.prototype[method] = function(url, data, config) {
+ return this.request(mergeConfig(config || {}, {
+ method: method,
+ url: url,
+ data: data
+ }));
+ };
+});
+
+module.exports = Axios;
diff --git a/lib/core/InterceptorManager.js b/lib/core/InterceptorManager.js
new file mode 100644
index 0000000..50d667b
--- /dev/null
+++ b/lib/core/InterceptorManager.js
@@ -0,0 +1,52 @@
+'use strict';
+
+var utils = require('./../utils');
+
+function InterceptorManager() {
+ this.handlers = [];
+}
+
+/**
+ * Add a new interceptor to the stack
+ *
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
+ *
+ * @return {Number} An ID used to remove interceptor later
+ */
+InterceptorManager.prototype.use = function use(fulfilled, rejected) {
+ this.handlers.push({
+ fulfilled: fulfilled,
+ rejected: rejected
+ });
+ return this.handlers.length - 1;
+};
+
+/**
+ * Remove an interceptor from the stack
+ *
+ * @param {Number} id The ID that was returned by `use`
+ */
+InterceptorManager.prototype.eject = function eject(id) {
+ if (this.handlers[id]) {
+ this.handlers[id] = null;
+ }
+};
+
+/**
+ * Iterate over all the registered interceptors
+ *
+ * This method is particularly useful for skipping over any
+ * interceptors that may have become `null` calling `eject`.
+ *
+ * @param {Function} fn The function to call for each interceptor
+ */
+InterceptorManager.prototype.forEach = function forEach(fn) {
+ utils.forEach(this.handlers, function forEachHandler(h) {
+ if (h !== null) {
+ fn(h);
+ }
+ });
+};
+
+module.exports = InterceptorManager;
diff --git a/lib/core/README.md b/lib/core/README.md
new file mode 100644
index 0000000..253bc48
--- /dev/null
+++ b/lib/core/README.md
@@ -0,0 +1,7 @@
+# axios // core
+
+The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
+
+- Dispatching requests
+- Managing interceptors
+- Handling config
diff --git a/lib/core/buildFullPath.js b/lib/core/buildFullPath.js
new file mode 100644
index 0000000..00b2b05
--- /dev/null
+++ b/lib/core/buildFullPath.js
@@ -0,0 +1,20 @@
+'use strict';
+
+var isAbsoluteURL = require('../helpers/isAbsoluteURL');
+var combineURLs = require('../helpers/combineURLs');
+
+/**
+ * Creates a new URL by combining the baseURL with the requestedURL,
+ * only when the requestedURL is not already an absolute URL.
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} requestedURL Absolute or relative URL to combine
+ * @returns {string} The combined full path
+ */
+module.exports = function buildFullPath(baseURL, requestedURL) {
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
+ return combineURLs(baseURL, requestedURL);
+ }
+ return requestedURL;
+};
diff --git a/lib/core/createError.js b/lib/core/createError.js
new file mode 100644
index 0000000..933680f
--- /dev/null
+++ b/lib/core/createError.js
@@ -0,0 +1,18 @@
+'use strict';
+
+var enhanceError = require('./enhanceError');
+
+/**
+ * Create an Error with the specified message, config, error code, request and response.
+ *
+ * @param {string} message The error message.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The created error.
+ */
+module.exports = function createError(message, config, code, request, response) {
+ var error = new Error(message);
+ return enhanceError(error, config, code, request, response);
+};
diff --git a/lib/core/dispatchRequest.js b/lib/core/dispatchRequest.js
new file mode 100644
index 0000000..c8267ad
--- /dev/null
+++ b/lib/core/dispatchRequest.js
@@ -0,0 +1,79 @@
+'use strict';
+
+var utils = require('./../utils');
+var transformData = require('./transformData');
+var isCancel = require('../cancel/isCancel');
+var defaults = require('../defaults');
+
+/**
+ * Throws a `Cancel` if cancellation has been requested.
+ */
+function throwIfCancellationRequested(config) {
+ if (config.cancelToken) {
+ config.cancelToken.throwIfRequested();
+ }
+}
+
+/**
+ * Dispatch a request to the server using the configured adapter.
+ *
+ * @param {object} config The config that is to be used for the request
+ * @returns {Promise} The Promise to be fulfilled
+ */
+module.exports = function dispatchRequest(config) {
+ throwIfCancellationRequested(config);
+
+ // Ensure headers exist
+ config.headers = config.headers || {};
+
+ // Transform request data
+ config.data = transformData(
+ config.data,
+ config.headers,
+ config.transformRequest
+ );
+
+ // Flatten headers
+ config.headers = utils.merge(
+ config.headers.common || {},
+ config.headers[config.method] || {},
+ config.headers
+ );
+
+ utils.forEach(
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
+ function cleanHeaderConfig(method) {
+ delete config.headers[method];
+ }
+ );
+
+ var adapter = config.adapter || defaults.adapter;
+
+ return adapter(config).then(function onAdapterResolution(response) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ response.data = transformData(
+ response.data,
+ response.headers,
+ config.transformResponse
+ );
+
+ return response;
+ }, function onAdapterRejection(reason) {
+ if (!isCancel(reason)) {
+ throwIfCancellationRequested(config);
+
+ // Transform response data
+ if (reason && reason.response) {
+ reason.response.data = transformData(
+ reason.response.data,
+ reason.response.headers,
+ config.transformResponse
+ );
+ }
+ }
+
+ return Promise.reject(reason);
+ });
+};
diff --git a/lib/core/enhanceError.js b/lib/core/enhanceError.js
new file mode 100644
index 0000000..b6bc444
--- /dev/null
+++ b/lib/core/enhanceError.js
@@ -0,0 +1,42 @@
+'use strict';
+
+/**
+ * Update an Error with the specified config, error code, and response.
+ *
+ * @param {Error} error The error to update.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The error.
+ */
+module.exports = function enhanceError(error, config, code, request, response) {
+ error.config = config;
+ if (code) {
+ error.code = code;
+ }
+
+ error.request = request;
+ error.response = response;
+ error.isAxiosError = true;
+
+ error.toJSON = function toJSON() {
+ return {
+ // Standard
+ message: this.message,
+ name: this.name,
+ // Microsoft
+ description: this.description,
+ number: this.number,
+ // Mozilla
+ fileName: this.fileName,
+ lineNumber: this.lineNumber,
+ columnNumber: this.columnNumber,
+ stack: this.stack,
+ // Axios
+ config: this.config,
+ code: this.code
+ };
+ };
+ return error;
+};
diff --git a/lib/core/mergeConfig.js b/lib/core/mergeConfig.js
new file mode 100644
index 0000000..5a2c10c
--- /dev/null
+++ b/lib/core/mergeConfig.js
@@ -0,0 +1,87 @@
+'use strict';
+
+var utils = require('../utils');
+
+/**
+ * Config-specific merge-function which creates a new config-object
+ * by merging two configuration objects together.
+ *
+ * @param {Object} config1
+ * @param {Object} config2
+ * @returns {Object} New object resulting from merging config2 to config1
+ */
+module.exports = function mergeConfig(config1, config2) {
+ // eslint-disable-next-line no-param-reassign
+ config2 = config2 || {};
+ var config = {};
+
+ var valueFromConfig2Keys = ['url', 'method', 'data'];
+ var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
+ var defaultToConfig2Keys = [
+ 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
+ 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
+ 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
+ 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
+ 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
+ ];
+ var directMergeKeys = ['validateStatus'];
+
+ function getMergedValue(target, source) {
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
+ return utils.merge(target, source);
+ } else if (utils.isPlainObject(source)) {
+ return utils.merge({}, source);
+ } else if (utils.isArray(source)) {
+ return source.slice();
+ }
+ return source;
+ }
+
+ function mergeDeepProperties(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(config1[prop], config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ }
+
+ utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(undefined, config2[prop]);
+ }
+ });
+
+ utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
+
+ utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
+ if (!utils.isUndefined(config2[prop])) {
+ config[prop] = getMergedValue(undefined, config2[prop]);
+ } else if (!utils.isUndefined(config1[prop])) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ });
+
+ utils.forEach(directMergeKeys, function merge(prop) {
+ if (prop in config2) {
+ config[prop] = getMergedValue(config1[prop], config2[prop]);
+ } else if (prop in config1) {
+ config[prop] = getMergedValue(undefined, config1[prop]);
+ }
+ });
+
+ var axiosKeys = valueFromConfig2Keys
+ .concat(mergeDeepPropertiesKeys)
+ .concat(defaultToConfig2Keys)
+ .concat(directMergeKeys);
+
+ var otherKeys = Object
+ .keys(config1)
+ .concat(Object.keys(config2))
+ .filter(function filterAxiosKeys(key) {
+ return axiosKeys.indexOf(key) === -1;
+ });
+
+ utils.forEach(otherKeys, mergeDeepProperties);
+
+ return config;
+};
diff --git a/lib/core/settle.js b/lib/core/settle.js
new file mode 100644
index 0000000..886adb0
--- /dev/null
+++ b/lib/core/settle.js
@@ -0,0 +1,25 @@
+'use strict';
+
+var createError = require('./createError');
+
+/**
+ * Resolve or reject a Promise based on response status.
+ *
+ * @param {Function} resolve A function that resolves the promise.
+ * @param {Function} reject A function that rejects the promise.
+ * @param {object} response The response.
+ */
+module.exports = function settle(resolve, reject, response) {
+ var validateStatus = response.config.validateStatus;
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
+ resolve(response);
+ } else {
+ reject(createError(
+ 'Request failed with status code ' + response.status,
+ response.config,
+ null,
+ response.request,
+ response
+ ));
+ }
+};
diff --git a/lib/core/transformData.js b/lib/core/transformData.js
new file mode 100644
index 0000000..e065362
--- /dev/null
+++ b/lib/core/transformData.js
@@ -0,0 +1,20 @@
+'use strict';
+
+var utils = require('./../utils');
+
+/**
+ * Transform the data for a request or a response
+ *
+ * @param {Object|String} data The data to be transformed
+ * @param {Array} headers The headers for the request or response
+ * @param {Array|Function} fns A single function or Array of functions
+ * @returns {*} The resulting transformed data
+ */
+module.exports = function transformData(data, headers, fns) {
+ /*eslint no-param-reassign:0*/
+ utils.forEach(fns, function transform(fn) {
+ data = fn(data, headers);
+ });
+
+ return data;
+};
diff --git a/lib/defaults.js b/lib/defaults.js
new file mode 100644
index 0000000..2b2a1a7
--- /dev/null
+++ b/lib/defaults.js
@@ -0,0 +1,98 @@
+'use strict';
+
+var utils = require('./utils');
+var normalizeHeaderName = require('./helpers/normalizeHeaderName');
+
+var DEFAULT_CONTENT_TYPE = {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+};
+
+function setContentTypeIfUnset(headers, value) {
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
+ headers['Content-Type'] = value;
+ }
+}
+
+function getDefaultAdapter() {
+ var adapter;
+ if (typeof XMLHttpRequest !== 'undefined') {
+ // For browsers use XHR adapter
+ adapter = require('./adapters/xhr');
+ } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
+ // For node use HTTP adapter
+ adapter = require('./adapters/http');
+ }
+ return adapter;
+}
+
+var defaults = {
+ adapter: getDefaultAdapter(),
+
+ transformRequest: [function transformRequest(data, headers) {
+ normalizeHeaderName(headers, 'Accept');
+ normalizeHeaderName(headers, 'Content-Type');
+ if (utils.isFormData(data) ||
+ utils.isArrayBuffer(data) ||
+ utils.isBuffer(data) ||
+ utils.isStream(data) ||
+ utils.isFile(data) ||
+ utils.isBlob(data)
+ ) {
+ return data;
+ }
+ if (utils.isArrayBufferView(data)) {
+ return data.buffer;
+ }
+ if (utils.isURLSearchParams(data)) {
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
+ return data.toString();
+ }
+ if (utils.isObject(data)) {
+ setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
+ return JSON.stringify(data);
+ }
+ return data;
+ }],
+
+ transformResponse: [function transformResponse(data) {
+ /*eslint no-param-reassign:0*/
+ if (typeof data === 'string') {
+ try {
+ data = JSON.parse(data);
+ } catch (e) { /* Ignore */ }
+ }
+ return data;
+ }],
+
+ /**
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
+ * timeout is not created.
+ */
+ timeout: 0,
+
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+
+ maxContentLength: -1,
+ maxBodyLength: -1,
+
+ validateStatus: function validateStatus(status) {
+ return status >= 200 && status < 300;
+ }
+};
+
+defaults.headers = {
+ common: {
+ 'Accept': 'application/json, text/plain, */*'
+ }
+};
+
+utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
+ defaults.headers[method] = {};
+});
+
+utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
+});
+
+module.exports = defaults;
diff --git a/lib/helpers/README.md b/lib/helpers/README.md
new file mode 100644
index 0000000..4ae3419
--- /dev/null
+++ b/lib/helpers/README.md
@@ -0,0 +1,7 @@
+# axios // helpers
+
+The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
+
+- Browser polyfills
+- Managing cookies
+- Parsing HTTP headers
diff --git a/lib/helpers/bind.js b/lib/helpers/bind.js
new file mode 100644
index 0000000..6147c60
--- /dev/null
+++ b/lib/helpers/bind.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function bind(fn, thisArg) {
+ 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);
+ };
+};
diff --git a/lib/helpers/buildURL.js b/lib/helpers/buildURL.js
new file mode 100644
index 0000000..31595c3
--- /dev/null
+++ b/lib/helpers/buildURL.js
@@ -0,0 +1,70 @@
+'use strict';
+
+var utils = require('./../utils');
+
+function encode(val) {
+ return encodeURIComponent(val).
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace(/%20/g, '+').
+ replace(/%5B/gi, '[').
+ replace(/%5D/gi, ']');
+}
+
+/**
+ * Build a URL by appending params to the end
+ *
+ * @param {string} url The base of the url (e.g., http://www.google.com)
+ * @param {object} [params] The params to be appended
+ * @returns {string} The formatted url
+ */
+module.exports = function buildURL(url, params, paramsSerializer) {
+ /*eslint no-param-reassign:0*/
+ if (!params) {
+ return url;
+ }
+
+ var serializedParams;
+ if (paramsSerializer) {
+ serializedParams = paramsSerializer(params);
+ } else if (utils.isURLSearchParams(params)) {
+ serializedParams = params.toString();
+ } else {
+ var parts = [];
+
+ utils.forEach(params, function serialize(val, key) {
+ if (val === null || typeof val === 'undefined') {
+ return;
+ }
+
+ if (utils.isArray(val)) {
+ key = key + '[]';
+ } else {
+ val = [val];
+ }
+
+ 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));
+ });
+ });
+
+ serializedParams = parts.join('&');
+ }
+
+ if (serializedParams) {
+ var hashmarkIndex = url.indexOf('#');
+ if (hashmarkIndex !== -1) {
+ url = url.slice(0, hashmarkIndex);
+ }
+
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
+ }
+
+ return url;
+};
diff --git a/lib/helpers/combineURLs.js b/lib/helpers/combineURLs.js
new file mode 100644
index 0000000..f1b58a5
--- /dev/null
+++ b/lib/helpers/combineURLs.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/**
+ * Creates a new URL by combining the specified URLs
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} relativeURL The relative URL
+ * @returns {string} The combined URL
+ */
+module.exports = function combineURLs(baseURL, relativeURL) {
+ return relativeURL
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
+ : baseURL;
+};
diff --git a/lib/helpers/cookies.js b/lib/helpers/cookies.js
new file mode 100644
index 0000000..5a8a666
--- /dev/null
+++ b/lib/helpers/cookies.js
@@ -0,0 +1,53 @@
+'use strict';
+
+var utils = require('./../utils');
+
+module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs support document.cookie
+ (function standardBrowserEnv() {
+ return {
+ write: function write(name, value, expires, path, domain, secure) {
+ var cookie = [];
+ cookie.push(name + '=' + encodeURIComponent(value));
+
+ if (utils.isNumber(expires)) {
+ cookie.push('expires=' + new Date(expires).toGMTString());
+ }
+
+ if (utils.isString(path)) {
+ cookie.push('path=' + path);
+ }
+
+ if (utils.isString(domain)) {
+ cookie.push('domain=' + domain);
+ }
+
+ if (secure === true) {
+ cookie.push('secure');
+ }
+
+ document.cookie = cookie.join('; ');
+ },
+
+ read: function read(name) {
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
+ return (match ? decodeURIComponent(match[3]) : null);
+ },
+
+ remove: function remove(name) {
+ this.write(name, '', Date.now() - 86400000);
+ }
+ };
+ })() :
+
+ // Non standard browser env (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return {
+ write: function write() {},
+ read: function read() { return null; },
+ remove: function remove() {}
+ };
+ })()
+);
diff --git a/lib/helpers/deprecatedMethod.js b/lib/helpers/deprecatedMethod.js
new file mode 100644
index 0000000..ed40965
--- /dev/null
+++ b/lib/helpers/deprecatedMethod.js
@@ -0,0 +1,24 @@
+'use strict';
+
+/*eslint no-console:0*/
+
+/**
+ * Supply a warning to the developer that a method they are using
+ * has been deprecated.
+ *
+ * @param {string} method The name of the deprecated method
+ * @param {string} [instead] The alternate method to use if applicable
+ * @param {string} [docs] The documentation URL to get further details
+ */
+module.exports = function deprecatedMethod(method, instead, docs) {
+ try {
+ console.warn(
+ 'DEPRECATED method `' + method + '`.' +
+ (instead ? ' Use `' + instead + '` instead.' : '') +
+ ' This method will be removed in a future release.');
+
+ if (docs) {
+ console.warn('For more information about usage see ' + docs);
+ }
+ } catch (e) { /* Ignore */ }
+};
diff --git a/lib/helpers/isAbsoluteURL.js b/lib/helpers/isAbsoluteURL.js
new file mode 100644
index 0000000..d33e992
--- /dev/null
+++ b/lib/helpers/isAbsoluteURL.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/**
+ * Determines whether the specified URL is absolute
+ *
+ * @param {string} url The URL to test
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
+ */
+module.exports = function isAbsoluteURL(url) {
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
+ // by any combination of letters, digits, plus, period, or hyphen.
+ return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
+};
diff --git a/lib/helpers/isAxiosError.js b/lib/helpers/isAxiosError.js
new file mode 100644
index 0000000..29ff41a
--- /dev/null
+++ b/lib/helpers/isAxiosError.js
@@ -0,0 +1,11 @@
+'use strict';
+
+/**
+ * Determines whether the payload is an error thrown by Axios
+ *
+ * @param {*} payload The value to test
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
+ */
+module.exports = function isAxiosError(payload) {
+ return (typeof payload === 'object') && (payload.isAxiosError === true);
+};
diff --git a/lib/helpers/isURLSameOrigin.js b/lib/helpers/isURLSameOrigin.js
new file mode 100644
index 0000000..f1d89ad
--- /dev/null
+++ b/lib/helpers/isURLSameOrigin.js
@@ -0,0 +1,68 @@
+'use strict';
+
+var utils = require('./../utils');
+
+module.exports = (
+ utils.isStandardBrowserEnv() ?
+
+ // Standard browser envs have full support of the APIs needed to test
+ // whether the request URL is of the same origin as current location.
+ (function standardBrowserEnv() {
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
+ var urlParsingNode = document.createElement('a');
+ var originURL;
+
+ /**
+ * Parse a URL to discover it's components
+ *
+ * @param {String} url The URL to be parsed
+ * @returns {Object}
+ */
+ function resolveURL(url) {
+ var href = url;
+
+ if (msie) {
+ // IE needs attribute set twice to normalize properties
+ urlParsingNode.setAttribute('href', href);
+ href = urlParsingNode.href;
+ }
+
+ urlParsingNode.setAttribute('href', href);
+
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+ return {
+ href: urlParsingNode.href,
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+ host: urlParsingNode.host,
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+ hostname: urlParsingNode.hostname,
+ port: urlParsingNode.port,
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
+ urlParsingNode.pathname :
+ '/' + urlParsingNode.pathname
+ };
+ }
+
+ originURL = resolveURL(window.location.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
+ */
+ return function isURLSameOrigin(requestURL) {
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
+ return (parsed.protocol === originURL.protocol &&
+ parsed.host === originURL.host);
+ };
+ })() :
+
+ // Non standard browser envs (web workers, react-native) lack needed support.
+ (function nonStandardBrowserEnv() {
+ return function isURLSameOrigin() {
+ return true;
+ };
+ })()
+);
diff --git a/lib/helpers/normalizeHeaderName.js b/lib/helpers/normalizeHeaderName.js
new file mode 100644
index 0000000..738c9fe
--- /dev/null
+++ b/lib/helpers/normalizeHeaderName.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var utils = require('../utils');
+
+module.exports = function normalizeHeaderName(headers, normalizedName) {
+ utils.forEach(headers, function processHeader(value, name) {
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
+ headers[normalizedName] = value;
+ delete headers[name];
+ }
+ });
+};
diff --git a/lib/helpers/parseHeaders.js b/lib/helpers/parseHeaders.js
new file mode 100644
index 0000000..8af2cc7
--- /dev/null
+++ b/lib/helpers/parseHeaders.js
@@ -0,0 +1,53 @@
+'use strict';
+
+var utils = require('./../utils');
+
+// Headers whose duplicates are ignored by node
+// c.f. https://nodejs.org/api/http.html#http_message_headers
+var ignoreDuplicateOf = [
+ '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'
+];
+
+/**
+ * Parse headers into an object
+ *
+ * ```
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
+ * Content-Type: application/json
+ * Connection: keep-alive
+ * Transfer-Encoding: chunked
+ * ```
+ *
+ * @param {String} headers Headers needing to be parsed
+ * @returns {Object} Headers parsed into an object
+ */
+module.exports = function parseHeaders(headers) {
+ var parsed = {};
+ var key;
+ var val;
+ var i;
+
+ if (!headers) { return parsed; }
+
+ utils.forEach(headers.split('\n'), function parser(line) {
+ i = line.indexOf(':');
+ key = utils.trim(line.substr(0, i)).toLowerCase();
+ val = utils.trim(line.substr(i + 1));
+
+ if (key) {
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
+ return;
+ }
+ if (key === 'set-cookie') {
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
+ } else {
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+ }
+ }
+ });
+
+ return parsed;
+};
diff --git a/lib/helpers/spread.js b/lib/helpers/spread.js
new file mode 100644
index 0000000..25e3cdd
--- /dev/null
+++ b/lib/helpers/spread.js
@@ -0,0 +1,27 @@
+'use strict';
+
+/**
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
+ *
+ * Common use case would be to use `Function.prototype.apply`.
+ *
+ * ```js
+ * function f(x, y, z) {}
+ * var args = [1, 2, 3];
+ * f.apply(null, args);
+ * ```
+ *
+ * With `spread` this example can be re-written.
+ *
+ * ```js
+ * spread(function(x, y, z) {})([1, 2, 3]);
+ * ```
+ *
+ * @param {Function} callback
+ * @returns {Function}
+ */
+module.exports = function spread(callback) {
+ return function wrap(arr) {
+ return callback.apply(null, arr);
+ };
+};
diff --git a/lib/utils.js b/lib/utils.js
new file mode 100644
index 0000000..83eb1c6
--- /dev/null
+++ b/lib/utils.js
@@ -0,0 +1,351 @@
+'use strict';
+
+var bind = require('./helpers/bind');
+
+/*global toString:true*/
+
+// utils is a library of generic helper functions non-specific to axios
+
+var toString = Object.prototype.toString;
+
+/**
+ * Determine if a value is an Array
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Array, otherwise false
+ */
+function isArray(val) {
+ return toString.call(val) === '[object Array]';
+}
+
+/**
+ * Determine if a value is undefined
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if the value is undefined, otherwise false
+ */
+function isUndefined(val) {
+ return typeof val === 'undefined';
+}
+
+/**
+ * Determine if a value is a Buffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Buffer, otherwise false
+ */
+function isBuffer(val) {
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
+}
+
+/**
+ * Determine if a value is an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
+ */
+function isArrayBuffer(val) {
+ return toString.call(val) === '[object ArrayBuffer]';
+}
+
+/**
+ * Determine if a value is a FormData
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an FormData, otherwise false
+ */
+function isFormData(val) {
+ return (typeof FormData !== 'undefined') && (val instanceof FormData);
+}
+
+/**
+ * Determine if a value is a view on an ArrayBuffer
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
+ */
+function isArrayBufferView(val) {
+ var result;
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
+ result = ArrayBuffer.isView(val);
+ } else {
+ result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
+ }
+ return result;
+}
+
+/**
+ * Determine if a value is a String
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a String, otherwise false
+ */
+function isString(val) {
+ return typeof val === 'string';
+}
+
+/**
+ * Determine if a value is a Number
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Number, otherwise false
+ */
+function isNumber(val) {
+ return typeof val === 'number';
+}
+
+/**
+ * Determine if a value is an Object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Object, otherwise false
+ */
+function isObject(val) {
+ return val !== null && typeof val === 'object';
+}
+
+/**
+ * Determine if a value is a plain Object
+ *
+ * @param {Object} val The value to test
+ * @return {boolean} True if value is a plain Object, otherwise false
+ */
+function isPlainObject(val) {
+ if (toString.call(val) !== '[object Object]') {
+ return false;
+ }
+
+ var prototype = Object.getPrototypeOf(val);
+ return prototype === null || prototype === Object.prototype;
+}
+
+/**
+ * Determine if a value is a Date
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Date, otherwise false
+ */
+function isDate(val) {
+ return toString.call(val) === '[object Date]';
+}
+
+/**
+ * Determine if a value is a File
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a File, otherwise false
+ */
+function isFile(val) {
+ return toString.call(val) === '[object File]';
+}
+
+/**
+ * Determine if a value is a Blob
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Blob, otherwise false
+ */
+function isBlob(val) {
+ return toString.call(val) === '[object Blob]';
+}
+
+/**
+ * Determine if a value is a Function
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Function, otherwise false
+ */
+function isFunction(val) {
+ return toString.call(val) === '[object Function]';
+}
+
+/**
+ * Determine if a value is a Stream
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Stream, otherwise false
+ */
+function isStream(val) {
+ return isObject(val) && isFunction(val.pipe);
+}
+
+/**
+ * Determine if a value is a URLSearchParams object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
+ */
+function isURLSearchParams(val) {
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
+}
+
+/**
+ * Trim excess whitespace off the beginning and end of a string
+ *
+ * @param {String} str The String to trim
+ * @returns {String} The String freed of excess whitespace
+ */
+function trim(str) {
+ return str.replace(/^\s*/, '').replace(/\s*$/, '');
+}
+
+/**
+ * Determine if we're running in a standard browser environment
+ *
+ * This allows axios to run in a web worker, and react-native.
+ * Both environments support XMLHttpRequest, but not fully standard globals.
+ *
+ * web workers:
+ * typeof window -> undefined
+ * typeof document -> undefined
+ *
+ * react-native:
+ * navigator.product -> 'ReactNative'
+ * nativescript
+ * navigator.product -> 'NativeScript' or 'NS'
+ */
+function isStandardBrowserEnv() {
+ if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
+ navigator.product === 'NativeScript' ||
+ navigator.product === 'NS')) {
+ return false;
+ }
+ return (
+ typeof window !== 'undefined' &&
+ typeof document !== 'undefined'
+ );
+}
+
+/**
+ * Iterate over an Array or an Object invoking a function for each item.
+ *
+ * If `obj` is an Array callback will be called passing
+ * the value, index, and complete array for each item.
+ *
+ * If 'obj' is an Object callback will be called passing
+ * the value, key, and complete object for each property.
+ *
+ * @param {Object|Array} obj The object to iterate
+ * @param {Function} fn The callback to invoke for each item
+ */
+function forEach(obj, fn) {
+ // Don't bother if no value provided
+ if (obj === null || typeof obj === 'undefined') {
+ return;
+ }
+
+ // Force an array if not already something iterable
+ if (typeof obj !== 'object') {
+ /*eslint no-param-reassign:0*/
+ obj = [obj];
+ }
+
+ if (isArray(obj)) {
+ // Iterate over array values
+ for (var i = 0, l = obj.length; i < l; i++) {
+ fn.call(null, obj[i], i, obj);
+ }
+ } else {
+ // Iterate over object keys
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ fn.call(null, obj[key], key, obj);
+ }
+ }
+ }
+}
+
+/**
+ * Accepts varargs expecting each argument to be an object, then
+ * immutably merges the properties of each object and returns result.
+ *
+ * When multiple objects contain the same key the later object in
+ * the arguments list will take precedence.
+ *
+ * Example:
+ *
+ * ```js
+ * var result = merge({foo: 123}, {foo: 456});
+ * console.log(result.foo); // outputs 456
+ * ```
+ *
+ * @param {Object} obj1 Object to merge
+ * @returns {Object} Result of all merge properties
+ */
+function merge(/* obj1, obj2, obj3, ... */) {
+ var result = {};
+ function assignValue(val, key) {
+ if (isPlainObject(result[key]) && isPlainObject(val)) {
+ result[key] = merge(result[key], val);
+ } else if (isPlainObject(val)) {
+ result[key] = merge({}, val);
+ } else if (isArray(val)) {
+ result[key] = val.slice();
+ } else {
+ result[key] = val;
+ }
+ }
+
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ forEach(arguments[i], assignValue);
+ }
+ return result;
+}
+
+/**
+ * Extends object a by mutably adding to it the properties of object b.
+ *
+ * @param {Object} a The object to be extended
+ * @param {Object} b The object to copy properties from
+ * @param {Object} thisArg The object to bind function to
+ * @return {Object} The resulting value of object a
+ */
+function extend(a, b, thisArg) {
+ forEach(b, function assignValue(val, key) {
+ if (thisArg && typeof val === 'function') {
+ a[key] = bind(val, thisArg);
+ } else {
+ a[key] = val;
+ }
+ });
+ return a;
+}
+
+/**
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
+ *
+ * @param {string} content with BOM
+ * @return {string} content value without BOM
+ */
+function stripBOM(content) {
+ if (content.charCodeAt(0) === 0xFEFF) {
+ content = content.slice(1);
+ }
+ return content;
+}
+
+module.exports = {
+ isArray: isArray,
+ isArrayBuffer: isArrayBuffer,
+ isBuffer: isBuffer,
+ isFormData: isFormData,
+ isArrayBufferView: isArrayBufferView,
+ isString: isString,
+ isNumber: isNumber,
+ isObject: isObject,
+ isPlainObject: isPlainObject,
+ isUndefined: isUndefined,
+ isDate: isDate,
+ isFile: isFile,
+ isBlob: isBlob,
+ isFunction: isFunction,
+ isStream: isStream,
+ isURLSearchParams: isURLSearchParams,
+ isStandardBrowserEnv: isStandardBrowserEnv,
+ forEach: forEach,
+ merge: merge,
+ extend: extend,
+ trim: trim,
+ stripBOM: stripBOM
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..659ef02
--- /dev/null
+++ b/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "axios",
+ "version": "0.21.1",
+ "description": "Promise based HTTP client for the browser and node.js",
+ "main": "index.js",
+ "scripts": {
+ "test": "grunt test && bundlesize",
+ "start": "node ./sandbox/server.js",
+ "build": "NODE_ENV=production grunt build",
+ "preversion": "npm test",
+ "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
+ "postversion": "git push && git push --tags",
+ "examples": "node ./examples/server.js",
+ "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
+ "fix": "eslint --fix lib/**/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/axios/axios.git"
+ },
+ "keywords": [
+ "xhr",
+ "http",
+ "ajax",
+ "promise",
+ "node"
+ ],
+ "author": "Matt Zabriskie",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/axios/axios/issues"
+ },
+ "homepage": "https://github.com/axios/axios",
+ "devDependencies": {
+ "bundlesize": "^0.17.0",
+ "coveralls": "^3.0.0",
+ "es6-promise": "^4.2.4",
+ "grunt": "^1.0.2",
+ "grunt-banner": "^0.6.0",
+ "grunt-cli": "^1.2.0",
+ "grunt-contrib-clean": "^1.1.0",
+ "grunt-contrib-watch": "^1.0.0",
+ "grunt-eslint": "^20.1.0",
+ "grunt-karma": "^2.0.0",
+ "grunt-mocha-test": "^0.13.3",
+ "grunt-ts": "^6.0.0-beta.19",
+ "grunt-webpack": "^1.0.18",
+ "istanbul-instrumenter-loader": "^1.0.0",
+ "jasmine-core": "^2.4.1",
+ "karma": "^1.3.0",
+ "karma-chrome-launcher": "^2.2.0",
+ "karma-coverage": "^1.1.1",
+ "karma-firefox-launcher": "^1.1.0",
+ "karma-jasmine": "^1.1.1",
+ "karma-jasmine-ajax": "^0.1.13",
+ "karma-opera-launcher": "^1.0.0",
+ "karma-safari-launcher": "^1.0.0",
+ "karma-sauce-launcher": "^1.2.0",
+ "karma-sinon": "^1.0.5",
+ "karma-sourcemap-loader": "^0.3.7",
+ "karma-webpack": "^1.7.0",
+ "load-grunt-tasks": "^3.5.2",
+ "minimist": "^1.2.0",
+ "mocha": "^5.2.0",
+ "sinon": "^4.5.0",
+ "typescript": "^2.8.1",
+ "url-search-params": "^0.10.0",
+ "webpack": "^1.13.1",
+ "webpack-dev-server": "^1.14.1"
+ },
+ "browser": {
+ "./lib/adapters/http.js": "./lib/adapters/xhr.js"
+ },
+ "jsdelivr": "dist/axios.min.js",
+ "unpkg": "dist/axios.min.js",
+ "typings": "./index.d.ts",
+ "dependencies": {
+ "follow-redirects": "^1.10.0"
+ },
+ "bundlesize": [
+ {
+ "path": "./dist/axios.min.js",
+ "threshold": "5kB"
+ }
+ ]
+}
diff --git a/sandbox/client.html b/sandbox/client.html
new file mode 100644
index 0000000..55051c2
--- /dev/null
+++ b/sandbox/client.html
@@ -0,0 +1,173 @@
+<!doctype html>
+<html>
+<head>
+ <title>axios</title>
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
+ <style type="text/css">
+ pre {
+ max-height: 200px;
+ min-height: 39px;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body class="container">
+ <h1>axios</h1>
+
+ <div class="well">
+ <h3>Input</h3>
+ <form role="form" onsubmit="return false;">
+ <div class="form-group">
+ <label for="url">URL</label>
+ <input id="url" type="url" class="form-control" placeholder="/api"/>
+ </div>
+ <div class="form-group">
+ <label for="method">Method</label>
+ <select id="method" class="form-control">
+ <option value="GET">GET</option>
+ <option value="POST">POST</option>
+ <option value="PUT">PUT</option>
+ <option value="DELETE">DELETE</option>
+ <option value="HEAD">HEAD</option>
+ <option value="PATCH">PATCH</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="params">Params</label>
+ <textarea id="params" class="form-control" placeholder='{"foo": "bar", "baz": 123.45}'></textarea>
+ </div>
+ <div class="form-group" style="display: none;">
+ <label for="data">Data</label>
+ <textarea id="data" class="form-control" placeholder='{"foo": "bar", "baz": 123.45}'></textarea>
+ </div>
+ <div class="form-group">
+ <label for="headers">Headers</label>
+ <textarea id="headers" class="form-control" placeholder='{"X-Requested-With": "XMLHttpRequest"}'></textarea>
+ </div>
+ <button id="submit" type="submit" class="btn btn-primary">Send Request</button>
+ </form>
+ </div>
+
+ <div class="well">
+ <h3>Request</h3>
+ <pre id="request">No Data</pre>
+ </div>
+
+ <div class="well">
+ <h3>Response</h3>
+ <pre id="response">No Data</pre>
+ </div>
+
+ <script src="/axios.js"></script>
+ <script>
+ (function () {
+ // Just for you IE8
+ if (typeof Array.prototype.indexOf === 'undefined') {
+ Array.prototype.indexOf = function (item) {
+ for (var i=0, l=this.length; i<l; i++) {
+ if (this[i] === item) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ }
+
+ var url = document.getElementById('url');
+ var method = document.getElementById('method');
+ var params = document.getElementById('params');
+ var data = document.getElementById('data');
+ var headers = document.getElementById('headers');
+ var submit = document.getElementById('submit');
+ var request = document.getElementById('request');
+ var response = document.getElementById('response');
+
+ function acceptsData(method) {
+ return ['PATCH', 'POST', 'PUT'].indexOf(method) > -1;
+ }
+
+ function getUrl() {
+ return url.value.length === 0 ? '/api' : url.value;
+ }
+
+ function getParams() {
+ return params.value.length === 0 ? null : JSON.parse(params.value);
+ }
+
+ function getData() {
+ return data.value.length === 0 ? null : JSON.parse(data.value);
+ }
+
+ function getHeaders() {
+ return headers.value.length === 0 ? null : JSON.parse(headers.value);
+ }
+
+ function syncWithLocalStorage() {
+ method.value = localStorage.getItem('method') || 'GET';
+ params.value = localStorage.getItem('params') || '';
+ data.value = localStorage.getItem('data') || '';
+ headers.value = localStorage.getItem('headers') || '';
+ }
+
+ function syncParamsAndData() {
+ switch (method.value) {
+ case 'PATCH':
+ case 'POST':
+ case 'PUT':
+ params.parentNode.style.display = 'none';
+ data.parentNode.style.display = '';
+ break;
+ default:
+ params.parentNode.style.display = '';
+ data.parentNode.style.display = 'none';
+ break;
+ }
+ }
+
+ submit.onclick = function () {
+ var options = {
+ url: getUrl(),
+ params: !acceptsData(method.value) ? getParams() : undefined,
+ data: acceptsData(method.value) ? getData() : undefined,
+ method: method.value,
+ headers: getHeaders()
+ };
+
+ request.innerHTML = JSON.stringify(options, null, 2);
+
+ axios(options)
+ .then(function (res) {
+ response.innerHTML = JSON.stringify(res.data, null, 2);
+ })
+ .catch(function (res) {
+ response.innerHTML = JSON.stringify(res.data, null, 2);
+ });
+ };
+
+ url.onchange = function () {
+ localStorage.setItem('url', url.value);
+ };
+
+ method.onchange = function () {
+ localStorage.setItem('method', method.value);
+ syncParamsAndData();
+ };
+
+ params.onchange = function () {
+ localStorage.setItem('params', params.value);
+ };
+
+ data.onchange = function () {
+ localStorage.setItem('data', data.value);
+ };
+
+ headers.onchange = function () {
+ localStorage.setItem('headers', headers.value);
+ };
+
+ syncWithLocalStorage();
+ syncParamsAndData();
+ })();
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/sandbox/client.js b/sandbox/client.js
new file mode 100644
index 0000000..9a18a69
--- /dev/null
+++ b/sandbox/client.js
@@ -0,0 +1,20 @@
+var axios = require('../index');
+
+var URL = 'http://127.0.0.1:3000/api';
+var BODY = {
+ foo: 'bar',
+ baz: 1234
+};
+
+function handleSuccess(data) { console.log(data); }
+function handleFailure(data) { console.log('error', data); }
+
+// GET
+axios.get(URL, { params: BODY })
+ .then(handleSuccess)
+ .catch(handleFailure);
+
+// POST
+axios.post(URL, BODY)
+ .then(handleSuccess)
+ .catch(handleFailure); \ No newline at end of file
diff --git a/sandbox/server.js b/sandbox/server.js
new file mode 100644
index 0000000..7a5d9a9
--- /dev/null
+++ b/sandbox/server.js
@@ -0,0 +1,80 @@
+var fs = require('fs');
+var url = require('url');
+var path = require('path');
+var http = require('http');
+var server;
+
+function pipeFileToResponse(res, file, type) {
+ if (type) {
+ res.writeHead(200, {
+ 'Content-Type': type
+ });
+ }
+
+ fs.createReadStream(path.join(__dirname, file)).pipe(res);
+}
+
+server = http.createServer(function (req, res) {
+ req.setEncoding('utf8');
+
+ var parsed = url.parse(req.url, true);
+ var pathname = parsed.pathname;
+
+ console.log('[' + new Date() + ']', req.method, pathname);
+
+ if (pathname === '/') {
+ pathname = '/index.html';
+ }
+
+ if (pathname === '/index.html') {
+ pipeFileToResponse(res, './client.html');
+ } else if (pathname === '/axios.js') {
+ pipeFileToResponse(res, '../dist/axios.js', 'text/javascript');
+ } else if (pathname === '/axios.map') {
+ pipeFileToResponse(res, '../dist/axios.map', 'text/javascript');
+ } else if (pathname === '/api') {
+ var status;
+ var result;
+ var data = '';
+
+ req.on('data', function (chunk) {
+ data += chunk;
+ });
+
+ req.on('end', function () {
+ try {
+ status = 200;
+ result = {
+ url: req.url,
+ data: data ? JSON.parse(data) : undefined,
+ method: req.method,
+ headers: req.headers
+ };
+ } catch (e) {
+ console.error('Error:', e.message);
+ status = 400;
+ result = {
+ error: e.message
+ };
+ }
+
+ res.writeHead(status, {
+ 'Content-Type': 'application/json'
+ });
+ res.end(JSON.stringify(result));
+ });
+ } else {
+ res.writeHead(404);
+ res.end('<h1>404 Not Found</h1>');
+ }
+});
+
+const PORT = 3000;
+
+server.listen(PORT, console.log(`Listening on localhost:${PORT}...`));
+server.on('error', (error) => {
+ if (error.code === 'EADDRINUSE') {
+ console.log(`Address localhost:${PORT} in use please retry when the port is available!`);
+ server.close();
+ }
+});
diff --git a/test/manual/basic.html b/test/manual/basic.html
new file mode 100644
index 0000000..35fa649
--- /dev/null
+++ b/test/manual/basic.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+</head>
+<body>
+
+An alert should be shown with the <code>{"name":"axios"}</code>
+
+<script src="promise.js"></script>
+<script src="../../dist/axios.js"></script>
+<script>
+ axios.get('./fixture.json').then(function(response) {
+ console.log(response);
+ alert(JSON.stringify(response.data));
+ alert('response headers:\n\n' + JSON.stringify(response.headers));
+ }, function(err) { console.log(err) });
+</script>
+
+</body>
+</html> \ No newline at end of file
diff --git a/test/manual/cors.html b/test/manual/cors.html
new file mode 100644
index 0000000..da6e946
--- /dev/null
+++ b/test/manual/cors.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+</head>
+<body>
+
+An alert should be shown with <code>{"status":"ok"}</code>
+
+<script src="promise.js"></script>
+<script src="../../dist/axios.js"></script>
+<script>
+ axios.get('http://cors-test.appspot.com/test').then(function(response) {
+ alert(JSON.stringify(response.data));
+ alert('response headers:\n\n' + JSON.stringify(response.headers));
+ }, function(err) { console.log(err) });
+</script>
+
+</body>
+</html> \ No newline at end of file
diff --git a/test/manual/fixture.json b/test/manual/fixture.json
new file mode 100644
index 0000000..5580765
--- /dev/null
+++ b/test/manual/fixture.json
@@ -0,0 +1,3 @@
+{
+ "name": "axios"
+} \ No newline at end of file
diff --git a/test/manual/promise.js b/test/manual/promise.js
new file mode 100644
index 0000000..2d48351
--- /dev/null
+++ b/test/manual/promise.js
@@ -0,0 +1,9 @@
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
+ * @version 3.0.2
+ */
+
+(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;var lib$es6$promise$asap$$customSchedulerFn;var lib$es6$promise$asap$$asap=function asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){if(lib$es6$promise$asap$$customSchedulerFn){lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush)}else{lib$es6$promise$asap$$scheduleFlush()}}};function lib$es6$promise$asap$$setScheduler(scheduleFn){lib$es6$promise$asap$$customSchedulerFn=scheduleFn}function lib$es6$promise$asap$$setAsap(asapFn){lib$es6$promise$asap$$asap=asapFn}var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){return function(){process.nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i<lib$es6$promise$asap$$len;i+=2){var callback=lib$es6$promise$asap$$queue[i];var arg=lib$es6$promise$asap$$queue[i+1];callback(arg);lib$es6$promise$asap$$queue[i]=undefined;lib$es6$promise$asap$$queue[i+1]=undefined}lib$es6$promise$asap$$len=0}function lib$es6$promise$asap$$attemptVertx(){try{var r=require;var vertx=r("vertx");lib$es6$promise$asap$$vertxNext=vertx.runOnLoop||vertx.runOnContext;return lib$es6$promise$asap$$useVertxTimer()}catch(e){return lib$es6$promise$asap$$useSetTimeout()}}var lib$es6$promise$asap$$scheduleFlush;if(lib$es6$promise$asap$$isNode){lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick()}else if(lib$es6$promise$asap$$BrowserMutationObserver){lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver()}else if(lib$es6$promise$asap$$isWorker){lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel()}else if(lib$es6$promise$asap$$browserWindow===undefined&&typeof require==="function"){lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertx()}else{lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout()}function lib$es6$promise$$internal$$noop(){}var lib$es6$promise$$internal$$PENDING=void 0;var lib$es6$promise$$internal$$FULFILLED=1;var lib$es6$promise$$internal$$REJECTED=2;var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject;function lib$es6$promise$$internal$$selfFulfillment(){return new TypeError("You cannot resolve a promise with itself")}function lib$es6$promise$$internal$$cannotReturnOwn(){return new TypeError("A promises callback cannot return that same promise.")}function lib$es6$promise$$internal$$getThen(promise){try{return promise.then}catch(error){lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;return lib$es6$promise$$internal$$GET_THEN_ERROR}}function lib$es6$promise$$internal$$tryThen(then,value,fulfillmentHandler,rejectionHandler){try{then.call(value,fulfillmentHandler,rejectionHandler)}catch(e){return e}}function lib$es6$promise$$internal$$handleForeignThenable(promise,thenable,then){lib$es6$promise$asap$$asap(function(promise){var sealed=false;var error=lib$es6$promise$$internal$$tryThen(then,thenable,function(value){if(sealed){return}sealed=true;if(thenable!==value){lib$es6$promise$$internal$$resolve(promise,value)}else{lib$es6$promise$$internal$$fulfill(promise,value)}},function(reason){if(sealed){return}sealed=true;lib$es6$promise$$internal$$reject(promise,reason)},"Settle: "+(promise._label||" unknown promise"));if(!sealed&&error){sealed=true;lib$es6$promise$$internal$$reject(promise,error)}},promise)}function lib$es6$promise$$internal$$handleOwnThenable(promise,thenable){if(thenable._state===lib$es6$promise$$internal$$FULFILLED){lib$es6$promise$$internal$$fulfill(promise,thenable._result)}else if(thenable._state===lib$es6$promise$$internal$$REJECTED){lib$es6$promise$$internal$$reject(promise,thenable._result)}else{lib$es6$promise$$internal$$subscribe(thenable,undefined,function(value){lib$es6$promise$$internal$$resolve(promise,value)},function(reason){lib$es6$promise$$internal$$reject(promise,reason)})}}function lib$es6$promise$$internal$$handleMaybeThenable(promise,maybeThenable){if(maybeThenable.constructor===promise.constructor){lib$es6$promise$$internal$$handleOwnThenable(promise,maybeThenable)}else{var then=lib$es6$promise$$internal$$getThen(maybeThenable);if(then===lib$es6$promise$$internal$$GET_THEN_ERROR){lib$es6$promise$$internal$$reject(promise,lib$es6$promise$$internal$$GET_THEN_ERROR.error)}else if(then===undefined){lib$es6$promise$$internal$$fulfill(promise,maybeThenable)}else if(lib$es6$promise$utils$$isFunction(then)){lib$es6$promise$$internal$$handleForeignThenable(promise,maybeThenable,then)}else{lib$es6$promise$$internal$$fulfill(promise,maybeThenable)}}}function lib$es6$promise$$internal$$resolve(promise,value){if(promise===value){lib$es6$promise$$internal$$reject(promise,lib$es6$promise$$internal$$selfFulfillment())}else if(lib$es6$promise$utils$$objectOrFunction(value)){lib$es6$promise$$internal$$handleMaybeThenable(promise,value)}else{lib$es6$promise$$internal$$fulfill(promise,value)}}function lib$es6$promise$$internal$$publishRejection(promise){if(promise._onerror){promise._onerror(promise._result)}lib$es6$promise$$internal$$publish(promise)}function lib$es6$promise$$internal$$fulfill(promise,value){if(promise._state!==lib$es6$promise$$internal$$PENDING){return}promise._result=value;promise._state=lib$es6$promise$$internal$$FULFILLED;if(promise._subscribers.length!==0){lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish,promise)}}function lib$es6$promise$$internal$$reject(promise,reason){if(promise._state!==lib$es6$promise$$internal$$PENDING){return}promise._state=lib$es6$promise$$internal$$REJECTED;promise._result=reason;lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection,promise)}function lib$es6$promise$$internal$$subscribe(parent,child,onFulfillment,onRejection){var subscribers=parent._subscribers;var length=subscribers.length;parent._onerror=null;subscribers[length]=child;subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;if(length===0&&parent._state){lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish,parent)}}function lib$es6$promise$$internal$$publish(promise){var subscribers=promise._subscribers;var settled=promise._state;if(subscribers.length===0){return}var child,callback,detail=promise._result;for(var i=0;i<subscribers.length;i+=3){child=subscribers[i];callback=subscribers[i+settled];if(child){lib$es6$promise$$internal$$invokeCallback(settled,child,callback,detail)}else{callback(detail)}}promise._subscribers.length=0}function lib$es6$promise$$internal$$ErrorObject(){this.error=null}var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject;function lib$es6$promise$$internal$$tryCatch(callback,detail){try{return callback(detail)}catch(e){lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;return lib$es6$promise$$internal$$TRY_CATCH_ERROR}}function lib$es6$promise$$internal$$invokeCallback(settled,promise,callback,detail){var hasCallback=lib$es6$promise$utils$$isFunction(callback),value,error,succeeded,failed;if(hasCallback){value=lib$es6$promise$$internal$$tryCatch(callback,detail);if(value===lib$es6$promise$$internal$$TRY_CATCH_ERROR){failed=true;error=value.error;value=null}else{succeeded=true}if(promise===value){lib$es6$promise$$internal$$reject(promise,lib$es6$promise$$internal$$cannotReturnOwn());return}}else{value=detail;succeeded=true}if(promise._state!==lib$es6$promise$$internal$$PENDING){}else if(hasCallback&&succeeded){lib$es6$promise$$internal$$resolve(promise,value)}else if(failed){lib$es6$promise$$internal$$reject(promise,error)}else if(settled===lib$es6$promise$$internal$$FULFILLED){lib$es6$promise$$internal$$fulfill(promise,value)}else if(settled===lib$es6$promise$$internal$$REJECTED){lib$es6$promise$$internal$$reject(promise,value)}}function lib$es6$promise$$internal$$initializePromise(promise,resolver){try{resolver(function resolvePromise(value){lib$es6$promise$$internal$$resolve(promise,value)},function rejectPromise(reason){lib$es6$promise$$internal$$reject(promise,reason)})}catch(e){lib$es6$promise$$internal$$reject(promise,e)}}function lib$es6$promise$enumerator$$Enumerator(Constructor,input){var enumerator=this;enumerator._instanceConstructor=Constructor;enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);if(enumerator._validateInput(input)){enumerator._input=input;enumerator.length=input.length;enumerator._remaining=input.length;enumerator._init();if(enumerator.length===0){lib$es6$promise$$internal$$fulfill(enumerator.promise,enumerator._result)}else{enumerator.length=enumerator.length||0;enumerator._enumerate();if(enumerator._remaining===0){lib$es6$promise$$internal$$fulfill(enumerator.promise,enumerator._result)}}}else{lib$es6$promise$$internal$$reject(enumerator.promise,enumerator._validationError())}}lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function(input){return lib$es6$promise$utils$$isArray(input)};lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")};lib$es6$promise$enumerator$$Enumerator.prototype._init=function(){this._result=new Array(this.length)};var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function(){var enumerator=this;var length=enumerator.length;var promise=enumerator.promise;var input=enumerator._input;for(var i=0;promise._state===lib$es6$promise$$internal$$PENDING&&i<length;i++){enumerator._eachEntry(input[i],i)}};lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function(entry,i){var enumerator=this;var c=enumerator._instanceConstructor;if(lib$es6$promise$utils$$isMaybeThenable(entry)){if(entry.constructor===c&&entry._state!==lib$es6$promise$$internal$$PENDING){entry._onerror=null;enumerator._settledAt(entry._state,i,entry._result)}else{enumerator._willSettleAt(c.resolve(entry),i)}}else{enumerator._remaining--;enumerator._result[i]=entry}};lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function(state,i,value){var enumerator=this;var promise=enumerator.promise;if(promise._state===lib$es6$promise$$internal$$PENDING){enumerator._remaining--;if(state===lib$es6$promise$$internal$$REJECTED){lib$es6$promise$$internal$$reject(promise,value)}else{enumerator._result[i]=value}}if(enumerator._remaining===0){lib$es6$promise$$internal$$fulfill(promise,enumerator._result)}};lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function(promise,i){var enumerator=this;lib$es6$promise$$internal$$subscribe(promise,undefined,function(value){enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED,i,value)},function(reason){enumerator._settledAt(lib$es6$promise$$internal$$REJECTED,i,reason)})};function lib$es6$promise$promise$all$$all(entries){return new lib$es6$promise$enumerator$$default(this,entries).promise}var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;function lib$es6$promise$promise$race$$race(entries){var Constructor=this;var promise=new Constructor(lib$es6$promise$$internal$$noop);if(!lib$es6$promise$utils$$isArray(entries)){lib$es6$promise$$internal$$reject(promise,new TypeError("You must pass an array to race."));return promise}var length=entries.length;function onFulfillment(value){lib$es6$promise$$internal$$resolve(promise,value)}function onRejection(reason){lib$es6$promise$$internal$$reject(promise,reason)}for(var i=0;promise._state===lib$es6$promise$$internal$$PENDING&&i<length;i++){lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]),undefined,onFulfillment,onRejection)}return promise}var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;function lib$es6$promise$promise$resolve$$resolve(object){var Constructor=this;if(object&&typeof object==="object"&&object.constructor===Constructor){return object}var promise=new Constructor(lib$es6$promise$$internal$$noop);lib$es6$promise$$internal$$resolve(promise,object);return promise}var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;function lib$es6$promise$promise$reject$$reject(reason){var Constructor=this;var promise=new Constructor(lib$es6$promise$$internal$$noop);lib$es6$promise$$internal$$reject(promise,reason);return promise}var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;var lib$es6$promise$promise$$counter=0;function lib$es6$promise$promise$$needsResolver(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function lib$es6$promise$promise$$needsNew(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;function lib$es6$promise$promise$$Promise(resolver){this._id=lib$es6$promise$promise$$counter++;this._state=undefined;this._result=undefined;this._subscribers=[];if(lib$es6$promise$$internal$$noop!==resolver){if(!lib$es6$promise$utils$$isFunction(resolver)){lib$es6$promise$promise$$needsResolver()}if(!(this instanceof lib$es6$promise$promise$$Promise)){lib$es6$promise$promise$$needsNew()}lib$es6$promise$$internal$$initializePromise(this,resolver)}}lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;lib$es6$promise$promise$$Promise.prototype={constructor:lib$es6$promise$promise$$Promise,then:function(onFulfillment,onRejection){var parent=this;var state=parent._state;if(state===lib$es6$promise$$internal$$FULFILLED&&!onFulfillment||state===lib$es6$promise$$internal$$REJECTED&&!onRejection){return this}var child=new this.constructor(lib$es6$promise$$internal$$noop);var result=parent._result;if(state){var callback=arguments[state-1];lib$es6$promise$asap$$asap(function(){lib$es6$promise$$internal$$invokeCallback(state,child,callback,result)})}else{lib$es6$promise$$internal$$subscribe(parent,child,onFulfillment,onRejection)}return child},"catch":function(onRejection){return this.then(null,onRejection)}};function lib$es6$promise$polyfill$$polyfill(){var local;if(typeof global!=="undefined"){local=global}else if(typeof self!=="undefined"){local=self}else{try{local=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}}var P=local.Promise;if(P&&Object.prototype.toString.call(P.resolve())==="[object Promise]"&&!P.cast){return}local.Promise=lib$es6$promise$promise$$default}var lib$es6$promise$polyfill$$default=lib$es6$promise$polyfill$$polyfill;var lib$es6$promise$umd$$ES6Promise={Promise:lib$es6$promise$promise$$default,polyfill:lib$es6$promise$polyfill$$default};if(typeof define==="function"&&define["amd"]){define(function(){return lib$es6$promise$umd$$ES6Promise})}else if(typeof module!=="undefined"&&module["exports"]){module["exports"]=lib$es6$promise$umd$$ES6Promise}else if(typeof this!=="undefined"){this["ES6Promise"]=lib$es6$promise$umd$$ES6Promise}lib$es6$promise$polyfill$$default()}).call(this); \ No newline at end of file
diff --git a/test/specs/__helpers.js b/test/specs/__helpers.js
new file mode 100644
index 0000000..a08b8eb
--- /dev/null
+++ b/test/specs/__helpers.js
@@ -0,0 +1,123 @@
+// Polyfill ES6 Promise
+require('es6-promise').polyfill();
+
+// Polyfill URLSearchParams
+URLSearchParams = require('url-search-params');
+
+// Import axios
+axios = require('../../index');
+
+// Jasmine config
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
+jasmine.getEnv().defaultTimeoutInterval = 20000;
+
+// Get Ajax request using an increasing timeout to retry
+getAjaxRequest = (function () {
+var attempts = 0;
+var MAX_ATTEMPTS = 5;
+var ATTEMPT_DELAY_FACTOR = 5;
+
+function getAjaxRequest() {
+ return new Promise(function (resolve, reject) {
+ attempts = 0;
+ attemptGettingAjaxRequest(resolve, reject);
+ });
+}
+
+function attemptGettingAjaxRequest(resolve, reject) {
+ var delay = attempts * attempts * ATTEMPT_DELAY_FACTOR;
+
+ if (attempts++ > MAX_ATTEMPTS) {
+ reject(new Error('No request was found'));
+ return;
+ }
+
+ setTimeout(function () {
+ var request = jasmine.Ajax.requests.mostRecent();
+ if (request) {
+ resolve(request);
+ } else {
+ attemptGettingAjaxRequest(resolve, reject);
+ }
+ }, delay);
+}
+
+return getAjaxRequest;
+})();
+
+// Validate an invalid character error
+validateInvalidCharacterError = function validateInvalidCharacterError(error) {
+ expect(/character/i.test(error.message)).toEqual(true);
+};
+
+// Setup basic auth tests
+setupBasicAuthTest = function setupBasicAuthTest() {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should accept HTTP Basic auth with username/password', function (done) {
+ axios('/foo', {
+ auth: {
+ username: 'Aladdin',
+ password: 'open sesame'
+ }
+ });
+
+ setTimeout(function () {
+ var request = jasmine.Ajax.requests.mostRecent();
+
+ expect(request.requestHeaders['Authorization']).toEqual('Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==');
+ done();
+ }, 100);
+ });
+
+ it('should accept HTTP Basic auth credentials without the password parameter', function (done) {
+ axios('/foo', {
+ auth: {
+ username: 'Aladdin'
+ }
+ });
+
+ setTimeout(function () {
+ var request = jasmine.Ajax.requests.mostRecent();
+
+ expect(request.requestHeaders['Authorization']).toEqual('Basic QWxhZGRpbjo=');
+ done();
+ }, 100);
+ });
+
+ it('should accept HTTP Basic auth credentials with non-Latin1 characters in password', function (done) {
+ axios('/foo', {
+ auth: {
+ username: 'Aladdin',
+ password: 'open ßç£☃sesame'
+ }
+ });
+
+ setTimeout(function () {
+ var request = jasmine.Ajax.requests.mostRecent();
+
+ expect(request.requestHeaders['Authorization']).toEqual('Basic QWxhZGRpbjpvcGVuIMOfw6fCo+KYg3Nlc2FtZQ==');
+ done();
+ }, 100);
+ });
+
+ it('should fail to encode HTTP Basic auth credentials with non-Latin1 characters in username', function (done) {
+ axios('/foo', {
+ auth: {
+ username: 'Aladßç£☃din',
+ password: 'open sesame'
+ }
+ }).then(function(response) {
+ done(new Error('Should not succeed to make a HTTP Basic auth request with non-latin1 chars in credentials.'));
+ }).catch(function(error) {
+ validateInvalidCharacterError(error);
+ done();
+ });
+ });
+};
diff --git a/test/specs/adapter.spec.js b/test/specs/adapter.spec.js
new file mode 100644
index 0000000..6a00bc9
--- /dev/null
+++ b/test/specs/adapter.spec.js
@@ -0,0 +1,19 @@
+var axios = require('../../index');
+
+describe('adapter', function () {
+ it('should support custom adapter', function (done) {
+ var called = false;
+
+ axios('/foo', {
+ adapter: function (config) {
+ called = true;
+ }
+ });
+
+ setTimeout(function () {
+ expect(called).toBe(true);
+ done();
+ }, 100);
+ });
+});
+
diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js
new file mode 100644
index 0000000..eaeadfa
--- /dev/null
+++ b/test/specs/api.spec.js
@@ -0,0 +1,68 @@
+describe('static api', function () {
+ it('should have request method helpers', function () {
+ expect(typeof axios.request).toEqual('function');
+ expect(typeof axios.get).toEqual('function');
+ expect(typeof axios.head).toEqual('function');
+ expect(typeof axios.options).toEqual('function');
+ expect(typeof axios.delete).toEqual('function');
+ expect(typeof axios.post).toEqual('function');
+ expect(typeof axios.put).toEqual('function');
+ expect(typeof axios.patch).toEqual('function');
+ });
+
+ it('should have promise method helpers', function () {
+ var promise = axios();
+
+ expect(typeof promise.then).toEqual('function');
+ expect(typeof promise.catch).toEqual('function');
+ });
+
+ it('should have defaults', function () {
+ expect(typeof axios.defaults).toEqual('object');
+ expect(typeof axios.defaults.headers).toEqual('object');
+ });
+
+ it('should have interceptors', function () {
+ expect(typeof axios.interceptors.request).toEqual('object');
+ expect(typeof axios.interceptors.response).toEqual('object');
+ });
+
+ it('should have all/spread helpers', function () {
+ expect(typeof axios.all).toEqual('function');
+ expect(typeof axios.spread).toEqual('function');
+ });
+
+ it('should have factory method', function () {
+ expect(typeof axios.create).toEqual('function');
+ });
+
+ it('should have Cancel, CancelToken, and isCancel properties', function () {
+ expect(typeof axios.Cancel).toEqual('function');
+ expect(typeof axios.CancelToken).toEqual('function');
+ expect(typeof axios.isCancel).toEqual('function');
+ });
+
+ it('should have isAxiosError properties', function () {
+ expect(typeof axios.isAxiosError).toEqual('function');
+ });
+});
+
+describe('instance api', function () {
+ var instance = axios.create();
+
+ it('should have request methods', function () {
+ expect(typeof instance.request).toEqual('function');
+ expect(typeof instance.get).toEqual('function');
+ expect(typeof instance.options).toEqual('function');
+ expect(typeof instance.head).toEqual('function');
+ expect(typeof instance.delete).toEqual('function');
+ expect(typeof instance.post).toEqual('function');
+ expect(typeof instance.put).toEqual('function');
+ expect(typeof instance.patch).toEqual('function');
+ });
+
+ it('should have interceptors', function () {
+ expect(typeof instance.interceptors.request).toEqual('object');
+ expect(typeof instance.interceptors.response).toEqual('object');
+ });
+});
diff --git a/test/specs/basicAuth.spec.js b/test/specs/basicAuth.spec.js
new file mode 100644
index 0000000..8c10117
--- /dev/null
+++ b/test/specs/basicAuth.spec.js
@@ -0,0 +1,3 @@
+describe('basicAuth', function () {
+ setupBasicAuthTest();
+});
diff --git a/test/specs/cancel.spec.js b/test/specs/cancel.spec.js
new file mode 100644
index 0000000..42b2b4e
--- /dev/null
+++ b/test/specs/cancel.spec.js
@@ -0,0 +1,89 @@
+var Cancel = axios.Cancel;
+var CancelToken = axios.CancelToken;
+
+describe('cancel', function() {
+ beforeEach(function() {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function() {
+ jasmine.Ajax.uninstall();
+ });
+
+ describe('when called before sending request', function() {
+ it('rejects Promise with a Cancel object', function (done) {
+ var source = CancelToken.source();
+ source.cancel('Operation has been canceled.');
+ axios.get('/foo', {
+ cancelToken: source.token
+ }).catch(function (thrown) {
+ expect(thrown).toEqual(jasmine.any(Cancel));
+ expect(thrown.message).toBe('Operation has been canceled.');
+ done();
+ });
+ });
+ });
+
+ describe('when called after request has been sent', function() {
+ it('rejects Promise with a Cancel object', function (done) {
+ var source = CancelToken.source();
+ axios.get('/foo/bar', {
+ cancelToken: source.token
+ }).catch(function (thrown) {
+ expect(thrown).toEqual(jasmine.any(Cancel));
+ expect(thrown.message).toBe('Operation has been canceled.');
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ // call cancel() when the request has been sent, but a response has not been received
+ source.cancel('Operation has been canceled.');
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+ });
+ });
+
+ it('calls abort on request object', function (done) {
+ var source = CancelToken.source();
+ var request;
+ axios.get('/foo/bar', {
+ cancelToken: source.token
+ }).catch(function() {
+ // jasmine-ajax sets statusText to 'abort' when request.abort() is called
+ expect(request.statusText).toBe('abort');
+ done();
+ });
+
+ getAjaxRequest().then(function (req) {
+ // call cancel() when the request has been sent, but a response has not been received
+ source.cancel();
+ request = req;
+ });
+ });
+ });
+
+ describe('when called after response has been received', function() {
+ // https://github.com/axios/axios/issues/482
+ it('does not cause unhandled rejection', function (done) {
+ var source = CancelToken.source();
+ axios.get('/foo', {
+ cancelToken: source.token
+ }).then(function () {
+ window.addEventListener('unhandledrejection', function () {
+ done.fail('Unhandled rejection.');
+ });
+ source.cancel();
+ setTimeout(done, 100);
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+ });
+ });
+ });
+});
diff --git a/test/specs/cancel/Cancel.spec.js b/test/specs/cancel/Cancel.spec.js
new file mode 100644
index 0000000..0e0de80
--- /dev/null
+++ b/test/specs/cancel/Cancel.spec.js
@@ -0,0 +1,15 @@
+var Cancel = require('../../../lib/cancel/Cancel');
+
+describe('Cancel', function() {
+ describe('toString', function() {
+ it('returns correct result when message is not specified', function() {
+ var cancel = new Cancel();
+ expect(cancel.toString()).toBe('Cancel');
+ });
+
+ it('returns correct result when message is specified', function() {
+ var cancel = new Cancel('Operation has been canceled.');
+ expect(cancel.toString()).toBe('Cancel: Operation has been canceled.');
+ });
+ });
+});
diff --git a/test/specs/cancel/CancelToken.spec.js b/test/specs/cancel/CancelToken.spec.js
new file mode 100644
index 0000000..dd72327
--- /dev/null
+++ b/test/specs/cancel/CancelToken.spec.js
@@ -0,0 +1,87 @@
+var CancelToken = require('../../../lib/cancel/CancelToken');
+var Cancel = require('../../../lib/cancel/Cancel');
+
+describe('CancelToken', function() {
+ describe('constructor', function() {
+ it('throws when executor is not specified', function() {
+ expect(function() {
+ new CancelToken();
+ }).toThrowError(TypeError, 'executor must be a function.');
+ });
+
+ it('throws when executor is not a function', function() {
+ expect(function() {
+ new CancelToken(123);
+ }).toThrowError(TypeError, 'executor must be a function.');
+ });
+ });
+
+ describe('reason', function() {
+ it('returns a Cancel if cancellation has been requested', function() {
+ var cancel;
+ var token = new CancelToken(function(c) {
+ cancel = c;
+ });
+ cancel('Operation has been canceled.');
+ expect(token.reason).toEqual(jasmine.any(Cancel));
+ expect(token.reason.message).toBe('Operation has been canceled.');
+ });
+
+ it('returns undefined if cancellation has not been requested', function() {
+ var token = new CancelToken(function() {});
+ expect(token.reason).toBeUndefined();
+ });
+ });
+
+ describe('promise', function() {
+ it('returns a Promise that resolves when cancellation is requested', function(done) {
+ var cancel;
+ var token = new CancelToken(function(c) {
+ cancel = c;
+ });
+ token.promise.then(function onFulfilled(value) {
+ expect(value).toEqual(jasmine.any(Cancel));
+ expect(value.message).toBe('Operation has been canceled.');
+ done();
+ });
+ cancel('Operation has been canceled.');
+ });
+ });
+
+ describe('throwIfRequested', function() {
+ it('throws if cancellation has been requested', function() {
+ // Note: we cannot use expect.toThrowError here as Cancel does not inherit from Error
+ var cancel;
+ var token = new CancelToken(function(c) {
+ cancel = c;
+ });
+ cancel('Operation has been canceled.');
+ try {
+ token.throwIfRequested();
+ fail('Expected throwIfRequested to throw.');
+ } catch (thrown) {
+ if (!(thrown instanceof Cancel)) {
+ fail('Expected throwIfRequested to throw a Cancel, but it threw ' + thrown + '.');
+ }
+ expect(thrown.message).toBe('Operation has been canceled.');
+ }
+ });
+
+ it('does not throw if cancellation has not been requested', function() {
+ var token = new CancelToken(function() {});
+ token.throwIfRequested();
+ });
+ });
+
+ describe('source', function() {
+ it('returns an object containing token and cancel function', function() {
+ var source = CancelToken.source();
+ expect(source.token).toEqual(jasmine.any(CancelToken));
+ expect(source.cancel).toEqual(jasmine.any(Function));
+ expect(source.token.reason).toBeUndefined();
+ source.cancel('Operation has been canceled.');
+ expect(source.token.reason).toEqual(jasmine.any(Cancel));
+ expect(source.token.reason.message).toBe('Operation has been canceled.');
+ });
+ });
+});
diff --git a/test/specs/cancel/isCancel.spec.js b/test/specs/cancel/isCancel.spec.js
new file mode 100644
index 0000000..e6be40d
--- /dev/null
+++ b/test/specs/cancel/isCancel.spec.js
@@ -0,0 +1,12 @@
+var isCancel = require('../../../lib/cancel/isCancel');
+var Cancel = require('../../../lib/cancel/Cancel');
+
+describe('isCancel', function() {
+ it('returns true if value is a Cancel', function() {
+ expect(isCancel(new Cancel())).toBe(true);
+ });
+
+ it('returns false if value is not a Cancel', function() {
+ expect(isCancel({ foo: 'bar' })).toBe(false);
+ });
+});
diff --git a/test/specs/core/buildFullPath.spec.js b/test/specs/core/buildFullPath.spec.js
new file mode 100644
index 0000000..e7a64d3
--- /dev/null
+++ b/test/specs/core/buildFullPath.spec.js
@@ -0,0 +1,20 @@
+var buildFullPath = require('../../../lib/core/buildFullPath');
+
+describe('helpers::buildFullPath', function () {
+ it('should combine URLs when the requestedURL is relative', function () {
+ expect(buildFullPath('https://api.github.com', '/users')).toBe('https://api.github.com/users');
+ });
+
+ it('should return the requestedURL when it is absolute', function () {
+ expect(buildFullPath('https://api.github.com', 'https://api.example.com/users')).toBe('https://api.example.com/users');
+ });
+
+ it('should not combine URLs when the baseURL is not configured', function () {
+ expect(buildFullPath(undefined, '/users')).toBe('/users');
+ });
+
+ it('should combine URLs when the baseURL and requestedURL are relative', function () {
+ expect(buildFullPath('/api', '/users')).toBe('/api/users');
+ });
+
+});
diff --git a/test/specs/core/createError.spec.js b/test/specs/core/createError.spec.js
new file mode 100644
index 0000000..53f708b
--- /dev/null
+++ b/test/specs/core/createError.spec.js
@@ -0,0 +1,29 @@
+var createError = require('../../../lib/core/createError');
+
+describe('core::createError', function() {
+ it('should create an Error with message, config, code, request, response and isAxiosError', function() {
+ var request = { path: '/foo' };
+ var response = { status: 200, data: { foo: 'bar' } };
+ var error = createError('Boom!', { foo: 'bar' }, 'ESOMETHING', request, response);
+ expect(error instanceof Error).toBe(true);
+ expect(error.message).toBe('Boom!');
+ expect(error.config).toEqual({ foo: 'bar' });
+ expect(error.code).toBe('ESOMETHING');
+ expect(error.request).toBe(request);
+ expect(error.response).toBe(response);
+ expect(error.isAxiosError).toBe(true);
+ });
+ it('should create an Error that can be serialized to JSON', function() {
+ // Attempting to serialize request and response results in
+ // TypeError: Converting circular structure to JSON
+ var request = { path: '/foo' };
+ var response = { status: 200, data: { foo: 'bar' } };
+ var error = createError('Boom!', { foo: 'bar' }, 'ESOMETHING', request, response);
+ var json = error.toJSON();
+ expect(json.message).toBe('Boom!');
+ expect(json.config).toEqual({ foo: 'bar' });
+ expect(json.code).toBe('ESOMETHING');
+ expect(json.request).toBe(undefined);
+ expect(json.response).toBe(undefined);
+ });
+});
diff --git a/test/specs/core/enhanceError.spec.js b/test/specs/core/enhanceError.spec.js
new file mode 100644
index 0000000..f8e24d1
--- /dev/null
+++ b/test/specs/core/enhanceError.spec.js
@@ -0,0 +1,21 @@
+var enhanceError = require('../../../lib/core/enhanceError');
+
+describe('core::enhanceError', function() {
+ it('should add config, config, request and response to error', function() {
+ var error = new Error('Boom!');
+ var request = { path: '/foo' };
+ var response = { status: 200, data: { foo: 'bar' } };
+
+ enhanceError(error, { foo: 'bar' }, 'ESOMETHING', request, response);
+ expect(error.config).toEqual({ foo: 'bar' });
+ expect(error.code).toBe('ESOMETHING');
+ expect(error.request).toBe(request);
+ expect(error.response).toBe(response);
+ expect(error.isAxiosError).toBe(true);
+ });
+
+ it('should return error', function() {
+ var error = new Error('Boom!');
+ expect(enhanceError(error, { foo: 'bar' }, 'ESOMETHING')).toBe(error);
+ });
+});
diff --git a/test/specs/core/mergeConfig.spec.js b/test/specs/core/mergeConfig.spec.js
new file mode 100644
index 0000000..cc8ab51
--- /dev/null
+++ b/test/specs/core/mergeConfig.spec.js
@@ -0,0 +1,310 @@
+var defaults = require('../../../lib/defaults');
+var mergeConfig = require('../../../lib/core/mergeConfig');
+
+describe('core::mergeConfig', function() {
+ it('should accept undefined for second argument', function() {
+ expect(mergeConfig(defaults, undefined)).toEqual(defaults);
+ });
+
+ it('should accept an object for second argument', function() {
+ expect(mergeConfig(defaults, {})).toEqual(defaults);
+ });
+
+ it('should not leave references', function() {
+ var merged = mergeConfig(defaults, {});
+ expect(merged).not.toBe(defaults);
+ expect(merged.headers).not.toBe(defaults.headers);
+ });
+
+ it('should allow setting request options', function() {
+ var config = {
+ url: '__sample url__',
+ method: '__sample method__',
+ params: '__sample params__',
+ data: { foo: true }
+ };
+ var merged = mergeConfig(defaults, config);
+ expect(merged.url).toEqual(config.url);
+ expect(merged.method).toEqual(config.method);
+ expect(merged.params).toEqual(config.params);
+ expect(merged.data).toEqual(config.data);
+ });
+
+ it('should not inherit request options', function() {
+ var localDefaults = {
+ method: '__sample method__',
+ data: { foo: true }
+ };
+ var merged = mergeConfig(localDefaults, {});
+ expect(merged.method).toEqual(undefined);
+ expect(merged.data).toEqual(undefined);
+ });
+
+ ['auth', 'headers', 'params', 'proxy'].forEach(function(key) {
+ it('should set new config for' + key + ' without default', function() {
+ var a = {}, b = {}, c = {}
+ a[key] = undefined
+ b[key] = { user: 'foo', pass: 'test' }
+ c[key] = { user: 'foo', pass: 'test' }
+
+ expect(mergeConfig(a, b)).toEqual(c);
+ });
+
+ it('should merge ' + key + ' with defaults', function() {
+ var a = {}, b = {}, c = {};
+ a[key] = { user: 'foo', pass: 'bar' };
+ b[key] = { pass: 'test' };
+ c[key] = { user: 'foo', pass: 'test' };
+
+ expect(mergeConfig(a, b)).toEqual(c);
+ });
+
+ it('should overwrite default ' + key + ' with a non-object value', function() {
+ [false, null, 123].forEach(function(value) {
+ var a = {}, b = {}, c = {};
+ a[key] = { user: 'foo', pass: 'test' };
+ b[key] = value;
+ c[key] = value;
+
+ expect(mergeConfig(a, b)).toEqual(c);
+ });
+ });
+ });
+
+ it('should allow setting other options', function() {
+ var merged = mergeConfig(defaults, { timeout: 123 });
+ expect(merged.timeout).toEqual(123);
+ });
+
+ it('should allow setting custom options', function() {
+ var merged = mergeConfig(defaults, { foo: 'bar' });
+ expect(merged.foo).toEqual('bar');
+ });
+
+ it('should allow setting custom default options', function() {
+ var merged = mergeConfig({ foo: 'bar' }, {});
+ expect(merged.foo).toEqual('bar');
+ });
+
+ it('should allow merging custom objects in the config', function() {
+ var merged = mergeConfig({
+ nestedConfig: {
+ propertyOnDefaultConfig: true
+ }
+ }, {
+ nestedConfig: {
+ propertyOnRequestConfig: true
+ }
+ });
+ expect(merged.nestedConfig.propertyOnDefaultConfig).toEqual(true);
+ expect(merged.nestedConfig.propertyOnRequestConfig).toEqual(true);
+ });
+
+ describe('valueFromConfig2Keys', function() {
+ var config1 = {url: '/foo', method: 'post', data: {a: 3}};
+
+ it('should skip if config2 is undefined', function() {
+ expect(mergeConfig(config1, {})).toEqual({});
+ });
+
+ it('should clone config2 if is plain object', function() {
+ var data = {a: 1, b: 2};
+ var merged = mergeConfig(config1, {data: data});
+ expect(merged.data).toEqual(data);
+ expect(merged.data).not.toBe(data);
+ });
+
+ it('should clone config2 if is array', function() {
+ var data = [1, 2, 3];
+ var merged = mergeConfig(config1, {data: data});
+ expect(merged.data).toEqual(data);
+ expect(merged.data).not.toBe(data);
+ });
+
+ it('should set as config2 in other cases', function() {
+ var obj = Object.create({});
+ expect(mergeConfig(config1, {data: 1}).data).toBe(1);
+ expect(mergeConfig(config1, {data: 'str'}).data).toBe('str');
+ expect(mergeConfig(config1, {data: obj}).data).toBe(obj);
+ expect(mergeConfig(config1, {data: null}).data).toBe(null);
+ });
+ });
+
+ describe('mergeDeepPropertiesKeys', function() {
+ it('should skip if both config1 and config2 are undefined', function() {
+ expect(mergeConfig({headers: undefined}, {headers: undefined})).toEqual({});
+ });
+
+ it('should merge if both config1 and config2 are plain object', function() {
+ expect(mergeConfig({headers: {a: 1, b: 1}}, {headers: {b: 2, c: 2}}))
+ .toEqual({headers: {a: 1, b: 2, c: 2}});
+ });
+
+ it('should clone config2 if is plain object', function() {
+ var config1 = {headers: [1, 2, 3]};
+ var config2 = {headers: {a: 1, b: 2}};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.headers).toEqual(config2.headers);
+ expect(merged.headers).not.toBe(config2.headers);
+ });
+
+ it('should clone config2 if is array', function() {
+ var config1 = {headers: {a: 1, b: 1}};
+ var config2 = {headers: [1, 2, 3]};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.headers).toEqual(config2.headers);
+ expect(merged.headers).not.toBe(config2.headers);
+ });
+
+ it('should set as config2 in other cases', function() {
+ var config1 = {headers: {a: 1, b: 1}};
+ var obj = Object.create({});
+ expect(mergeConfig(config1, {headers: 1}).headers).toBe(1);
+ expect(mergeConfig(config1, {headers: 'str'}).headers).toBe('str');
+ expect(mergeConfig(config1, {headers: obj}).headers).toBe(obj);
+ expect(mergeConfig(config1, {headers: null}).headers).toBe(null);
+ });
+
+ it('should clone config1 if is plain object', function() {
+ var config1 = {headers: {a: 1, b: 2}};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.headers).toEqual(config1.headers);
+ expect(merged.headers).not.toBe(config1.headers);
+ });
+
+ it('should clone config1 if is array', function() {
+ var config1 = {headers: [1, 2, 3]};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.headers).toEqual(config1.headers);
+ expect(merged.headers).not.toBe(config1.headers);
+ });
+
+ it('should set as config1 in other cases', function() {
+ var config2 = {};
+ var obj = Object.create({});
+ expect(mergeConfig({headers: 1}, config2).headers).toBe(1);
+ expect(mergeConfig({headers: 'str'}, config2).headers).toBe('str');
+ expect(mergeConfig({headers: obj}, config2).headers).toBe(obj);
+ expect(mergeConfig({headers: null}, config2).headers).toBe(null);
+ });
+ });
+
+ describe('defaultToConfig2Keys', function() {
+ it('should skip if both config1 and config2 are undefined', function() {
+ expect(mergeConfig({transformRequest: undefined}, {transformRequest: undefined})).toEqual({});
+ });
+
+ it('should clone config2 if both config1 and config2 are plain object', function() {
+ var config1 = {transformRequest: {a: 1, b: 1}};
+ var config2 = {transformRequest: {b: 2, c: 2}};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.transformRequest).toEqual(config2.transformRequest);
+ expect(merged.transformRequest).not.toBe(config2.transformRequest);
+ });
+
+ it('should clone config2 if is array', function() {
+ var config1 = {transformRequest: {a: 1, b: 1}};
+ var config2 = {transformRequest: [1, 2, 3]};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.transformRequest).toEqual(config2.transformRequest);
+ expect(merged.transformRequest).not.toBe(config2.transformRequest);
+ });
+
+ it('should set as config2 in other cases', function() {
+ var config1 = {transformRequest: {a: 1, b: 1}};
+ var obj = Object.create({});
+ expect(mergeConfig(config1, {transformRequest: 1}).transformRequest).toBe(1);
+ expect(mergeConfig(config1, {transformRequest: 'str'}).transformRequest).toBe('str');
+ expect(mergeConfig(config1, {transformRequest: obj}).transformRequest).toBe(obj);
+ expect(mergeConfig(config1, {transformRequest: null}).transformRequest).toBe(null);
+ });
+
+ it('should clone config1 if is plain object', function() {
+ var config1 = {transformRequest: {a: 1, b: 2}};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.transformRequest).toEqual(config1.transformRequest);
+ expect(merged.transformRequest).not.toBe(config1.transformRequest);
+ });
+
+ it('should clone config1 if is array', function() {
+ var config1 = {transformRequest: [1, 2, 3]};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.transformRequest).toEqual(config1.transformRequest);
+ expect(merged.transformRequest).not.toBe(config1.transformRequest);
+ });
+
+ it('should set as config1 in other cases', function() {
+ var config2 = {};
+ var obj = Object.create({});
+ expect(mergeConfig({transformRequest: 1}, config2).transformRequest).toBe(1);
+ expect(mergeConfig({transformRequest: 'str'}, config2).transformRequest).toBe('str');
+ expect(mergeConfig({transformRequest: obj}, config2).transformRequest).toBe(obj);
+ expect(mergeConfig({transformRequest: null}, config2).transformRequest).toBe(null);
+ });
+ });
+
+ describe('directMergeKeys', function() {
+ it('should merge if config2 in keys', function() {
+ expect(mergeConfig({}, {validateStatus: undefined})).toEqual({validateStatus: undefined});
+ });
+
+ it('should merge if both config1 and config2 are plain object', function() {
+ expect(mergeConfig({validateStatus: {a: 1, b: 1}}, {validateStatus: {b: 2, c: 2}}))
+ .toEqual({validateStatus: {a: 1, b: 2, c: 2}});
+ });
+
+ it('should clone config2 if is plain object', function() {
+ var config1 = {validateStatus: [1, 2, 3]};
+ var config2 = {validateStatus: {a: 1, b: 2}};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.validateStatus).toEqual(config2.validateStatus);
+ expect(merged.validateStatus).not.toBe(config2.validateStatus);
+ });
+
+ it('should clone config2 if is array', function() {
+ var config1 = {validateStatus: {a: 1, b: 2}};
+ var config2 = {validateStatus: [1, 2, 3]};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.validateStatus).toEqual(config2.validateStatus);
+ expect(merged.validateStatus).not.toBe(config2.validateStatus);
+ });
+
+ it('should set as config2 in other cases', function() {
+ var config1 = {validateStatus: {a: 1, b: 2}};
+ var obj = Object.create({});
+ expect(mergeConfig(config1, {validateStatus: 1}).validateStatus).toBe(1);
+ expect(mergeConfig(config1, {validateStatus: 'str'}).validateStatus).toBe('str');
+ expect(mergeConfig(config1, {validateStatus: obj}).validateStatus).toBe(obj);
+ expect(mergeConfig(config1, {validateStatus: null}).validateStatus).toBe(null);
+ });
+
+ it('should clone config1 if is plain object', function() {
+ var config1 = {validateStatus: {a: 1, b: 2}};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.validateStatus).toEqual(config1.validateStatus);
+ expect(merged.validateStatus).not.toBe(config1.validateStatus);
+ });
+
+ it('should clone config1 if is array', function() {
+ var config1 = {validateStatus: [1, 2, 3]};
+ var config2 = {};
+ var merged = mergeConfig(config1, config2);
+ expect(merged.validateStatus).toEqual(config1.validateStatus);
+ expect(merged.validateStatus).not.toBe(config1.validateStatus);
+ });
+
+ it('should set as config1 in other cases', function() {
+ var config2 = {};
+ var obj = Object.create({});
+ expect(mergeConfig({validateStatus: 1}, config2).validateStatus).toBe(1);
+ expect(mergeConfig({validateStatus: 'str'}, config2).validateStatus).toBe('str');
+ expect(mergeConfig({validateStatus: obj}, config2).validateStatus).toBe(obj);
+ expect(mergeConfig({validateStatus: null}, config2).validateStatus).toBe(null);
+ });
+ });
+});
diff --git a/test/specs/core/settle.spec.js b/test/specs/core/settle.spec.js
new file mode 100644
index 0000000..914bb9b
--- /dev/null
+++ b/test/specs/core/settle.spec.js
@@ -0,0 +1,85 @@
+var settle = require('../../../lib/core/settle');
+
+describe('core::settle', function() {
+ var resolve;
+ var reject;
+
+ beforeEach(function() {
+ resolve = jasmine.createSpy('resolve');
+ reject = jasmine.createSpy('reject');
+ });
+
+ it('should resolve promise if status is not set', function() {
+ var response = {
+ config: {
+ validateStatus: function() {
+ return true;
+ }
+ }
+ };
+ settle(resolve, reject, response);
+ expect(resolve).toHaveBeenCalledWith(response);
+ expect(reject).not.toHaveBeenCalled();
+ });
+
+ it('should resolve promise if validateStatus is not set', function() {
+ var response = {
+ status: 500,
+ config: {
+ }
+ };
+ settle(resolve, reject, response);
+ expect(resolve).toHaveBeenCalledWith(response);
+ expect(reject).not.toHaveBeenCalled();
+ });
+
+ it('should resolve promise if validateStatus returns true', function() {
+ var response = {
+ status: 500,
+ config: {
+ validateStatus: function() {
+ return true;
+ }
+ }
+ };
+ settle(resolve, reject, response);
+ expect(resolve).toHaveBeenCalledWith(response);
+ expect(reject).not.toHaveBeenCalled();
+ });
+
+ it('should reject promise if validateStatus returns false', function() {
+ var req = {
+ path: '/foo'
+ };
+ var response = {
+ status: 500,
+ config: {
+ validateStatus: function() {
+ return false;
+ }
+ },
+ request: req
+ };
+ settle(resolve, reject, response);
+ expect(resolve).not.toHaveBeenCalled();
+ expect(reject).toHaveBeenCalled();
+ var reason = reject.calls.first().args[0];
+ expect(reason instanceof Error).toBe(true);
+ expect(reason.message).toBe('Request failed with status code 500');
+ expect(reason.config).toBe(response.config);
+ expect(reason.request).toBe(req);
+ expect(reason.response).toBe(response);
+ });
+
+ it('should pass status to validateStatus', function() {
+ var validateStatus = jasmine.createSpy('validateStatus');
+ var response = {
+ status: 500,
+ config: {
+ validateStatus: validateStatus
+ }
+ };
+ settle(resolve, reject, response);
+ expect(validateStatus).toHaveBeenCalledWith(500);
+ });
+});
diff --git a/test/specs/core/transformData.spec.js b/test/specs/core/transformData.spec.js
new file mode 100644
index 0000000..95479bd
--- /dev/null
+++ b/test/specs/core/transformData.spec.js
@@ -0,0 +1,30 @@
+var transformData = require('../../../lib/core/transformData');
+
+describe('core::transformData', function () {
+ it('should support a single transformer', function () {
+ var data;
+ data = transformData(data, null, function (data) {
+ data = 'foo';
+ return data;
+ });
+
+ expect(data).toEqual('foo');
+ });
+
+ it('should support an array of transformers', function () {
+ var data = '';
+ data = transformData(data, null, [function (data) {
+ data += 'f';
+ return data;
+ }, function (data) {
+ data += 'o';
+ return data;
+ }, function (data) {
+ data += 'o';
+ return data;
+ }]);
+
+ expect(data).toEqual('foo');
+ });
+});
+
diff --git a/test/specs/defaults.spec.js b/test/specs/defaults.spec.js
new file mode 100644
index 0000000..c8ee72e
--- /dev/null
+++ b/test/specs/defaults.spec.js
@@ -0,0 +1,162 @@
+var defaults = require('../../lib/defaults');
+var utils = require('../../lib/utils');
+
+describe('defaults', function () {
+ var XSRF_COOKIE_NAME = 'CUSTOM-XSRF-TOKEN';
+
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ delete axios.defaults.baseURL;
+ delete axios.defaults.headers.get['X-CUSTOM-HEADER'];
+ delete axios.defaults.headers.post['X-CUSTOM-HEADER'];
+ document.cookie = XSRF_COOKIE_NAME + '=;expires=' + new Date(Date.now() - 86400000).toGMTString();
+ });
+
+ it('should transform request json', function () {
+ expect(defaults.transformRequest[0]({foo: 'bar'})).toEqual('{"foo":"bar"}');
+ });
+
+ it('should do nothing to request string', function () {
+ expect(defaults.transformRequest[0]('foo=bar')).toEqual('foo=bar');
+ });
+
+ it('should transform response json', function () {
+ var data = defaults.transformResponse[0]('{"foo":"bar"}');
+
+ expect(typeof data).toEqual('object');
+ expect(data.foo).toEqual('bar');
+ });
+
+ it('should do nothing to response string', function () {
+ expect(defaults.transformResponse[0]('foo=bar')).toEqual('foo=bar');
+ });
+
+ it('should use global defaults config', function (done) {
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+
+ it('should use modified defaults config', function (done) {
+ axios.defaults.baseURL = 'http://example.com/';
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://example.com/foo');
+ done();
+ });
+ });
+
+ it('should use request config', function (done) {
+ axios('/foo', {
+ baseURL: 'http://www.example.com'
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://www.example.com/foo');
+ done();
+ });
+ });
+
+ it('should use default config for custom instance', function (done) {
+ var instance = axios.create({
+ xsrfCookieName: XSRF_COOKIE_NAME,
+ xsrfHeaderName: 'X-CUSTOM-XSRF-TOKEN'
+ });
+ document.cookie = instance.defaults.xsrfCookieName + '=foobarbaz';
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[instance.defaults.xsrfHeaderName]).toEqual('foobarbaz');
+ done();
+ });
+ });
+
+ it('should use GET headers', function (done) {
+ axios.defaults.headers.get['X-CUSTOM-HEADER'] = 'foo';
+ axios.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['X-CUSTOM-HEADER']).toBe('foo');
+ done();
+ });
+ });
+
+ it('should use POST headers', function (done) {
+ axios.defaults.headers.post['X-CUSTOM-HEADER'] = 'foo';
+ axios.post('/foo', {});
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['X-CUSTOM-HEADER']).toBe('foo');
+ done();
+ });
+ });
+
+ it('should use header config', function (done) {
+ var instance = axios.create({
+ headers: {
+ common: {
+ 'X-COMMON-HEADER': 'commonHeaderValue'
+ },
+ get: {
+ 'X-GET-HEADER': 'getHeaderValue'
+ },
+ post: {
+ 'X-POST-HEADER': 'postHeaderValue'
+ }
+ }
+ });
+
+ instance.get('/foo', {
+ headers: {
+ 'X-FOO-HEADER': 'fooHeaderValue',
+ 'X-BAR-HEADER': 'barHeaderValue'
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders).toEqual(
+ utils.merge(defaults.headers.common, defaults.headers.get, {
+ 'X-COMMON-HEADER': 'commonHeaderValue',
+ 'X-GET-HEADER': 'getHeaderValue',
+ 'X-FOO-HEADER': 'fooHeaderValue',
+ 'X-BAR-HEADER': 'barHeaderValue'
+ })
+ );
+ done();
+ });
+ });
+
+ it('should be used by custom instance if set before instance created', function (done) {
+ axios.defaults.baseURL = 'http://example.org/';
+ var instance = axios.create();
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://example.org/foo');
+ done();
+ });
+ });
+
+ it('should not be used by custom instance if set after instance created', function (done) {
+ var instance = axios.create();
+ axios.defaults.baseURL = 'http://example.org/';
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+});
diff --git a/test/specs/headers.spec.js b/test/specs/headers.spec.js
new file mode 100644
index 0000000..c9c768d
--- /dev/null
+++ b/test/specs/headers.spec.js
@@ -0,0 +1,115 @@
+function testHeaderValue(headers, key, val) {
+ var found = false;
+
+ for (var k in headers) {
+ if (k.toLowerCase() === key.toLowerCase()) {
+ found = true;
+ expect(headers[k]).toEqual(val);
+ break;
+ }
+ }
+
+ if (!found) {
+ if (typeof val === 'undefined') {
+ expect(headers.hasOwnProperty(key)).toEqual(false);
+ } else {
+ throw new Error(key + ' was not found in headers');
+ }
+ }
+}
+
+describe('headers', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should default common headers', function (done) {
+ var headers = axios.defaults.headers.common;
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ for (var key in headers) {
+ if (headers.hasOwnProperty(key)) {
+ expect(request.requestHeaders[key]).toEqual(headers[key]);
+ }
+ }
+ done();
+ });
+ });
+
+ it('should add extra headers for post', function (done) {
+ var headers = axios.defaults.headers.common;
+
+ axios.post('/foo', 'fizz=buzz');
+
+ getAjaxRequest().then(function (request) {
+ for (var key in headers) {
+ if (headers.hasOwnProperty(key)) {
+ expect(request.requestHeaders[key]).toEqual(headers[key]);
+ }
+ }
+ done();
+ });
+ });
+
+ it('should reset headers by null or explicit undefined', function (done) {
+ axios.create({
+ headers: {
+ common: {
+ 'x-header-a': 'a',
+ 'x-header-b': 'b',
+ 'x-header-c': 'c'
+ }
+ }
+ }).post('/foo', {fizz: 'buzz'}, {
+ headers: {
+ 'Content-Type': null,
+ 'x-header-a': null,
+ 'x-header-b': undefined
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ testHeaderValue(request.requestHeaders, 'Content-Type', null);
+ testHeaderValue(request.requestHeaders, 'x-header-a', null);
+ testHeaderValue(request.requestHeaders, 'x-header-b', undefined);
+ testHeaderValue(request.requestHeaders, 'x-header-c', 'c');
+ done();
+ });
+ });
+
+ it('should use application/json when posting an object', function (done) {
+ axios.post('/foo/bar', {
+ firstName: 'foo',
+ lastName: 'bar'
+ });
+
+ getAjaxRequest().then(function (request) {
+ testHeaderValue(request.requestHeaders, 'Content-Type', 'application/json;charset=utf-8');
+ done();
+ });
+ });
+
+ it('should remove content-type if data is empty', function (done) {
+ axios.post('/foo');
+
+ getAjaxRequest().then(function (request) {
+ testHeaderValue(request.requestHeaders, 'Content-Type', undefined);
+ done();
+ });
+ });
+
+ it('should preserve content-type if data is false', function (done) {
+ axios.post('/foo', false);
+
+ getAjaxRequest().then(function (request) {
+ testHeaderValue(request.requestHeaders, 'Content-Type', 'application/x-www-form-urlencoded');
+ done();
+ });
+ });
+});
diff --git a/test/specs/helpers/bind.spec.js b/test/specs/helpers/bind.spec.js
new file mode 100644
index 0000000..a02c462
--- /dev/null
+++ b/test/specs/helpers/bind.spec.js
@@ -0,0 +1,12 @@
+var bind = require('../../../lib/helpers/bind');
+
+describe('bind', function () {
+ it('should bind an object to a function', function () {
+ var o = { val: 123 };
+ var f = bind(function (num) {
+ return this.val * num;
+ }, o);
+
+ expect(f(2)).toEqual(246);
+ });
+});
diff --git a/test/specs/helpers/buildURL.spec.js b/test/specs/helpers/buildURL.spec.js
new file mode 100644
index 0000000..7adf574
--- /dev/null
+++ b/test/specs/helpers/buildURL.spec.js
@@ -0,0 +1,75 @@
+var buildURL = require('../../../lib/helpers/buildURL');
+var URLSearchParams = require('url-search-params');
+
+describe('helpers::buildURL', function () {
+ it('should support null params', function () {
+ expect(buildURL('/foo')).toEqual('/foo');
+ });
+
+ it('should support params', function () {
+ expect(buildURL('/foo', {
+ foo: 'bar'
+ })).toEqual('/foo?foo=bar');
+ });
+
+ it('should support object params', function () {
+ expect(buildURL('/foo', {
+ foo: {
+ bar: 'baz'
+ }
+ })).toEqual('/foo?foo=' + encodeURI('{"bar":"baz"}'));
+ });
+
+ it('should support date params', function () {
+ var date = new Date();
+
+ expect(buildURL('/foo', {
+ date: date
+ })).toEqual('/foo?date=' + date.toISOString());
+ });
+
+ it('should support array params', function () {
+ expect(buildURL('/foo', {
+ foo: ['bar', 'baz']
+ })).toEqual('/foo?foo[]=bar&foo[]=baz');
+ });
+
+ it('should support special char params', function () {
+ expect(buildURL('/foo', {
+ foo: ':$, '
+ })).toEqual('/foo?foo=:$,+');
+ });
+
+ it('should support existing params', function () {
+ expect(buildURL('/foo?foo=bar', {
+ bar: 'baz'
+ })).toEqual('/foo?foo=bar&bar=baz');
+ });
+
+ it('should support "length" parameter', function () {
+ expect(buildURL('/foo', {
+ query: 'bar',
+ start: 0,
+ length: 5
+ })).toEqual('/foo?query=bar&start=0&length=5');
+ });
+
+ it('should correct discard url hash mark', function () {
+ expect(buildURL('/foo?foo=bar#hash', {
+ query: 'baz'
+ })).toEqual('/foo?foo=bar&query=baz');
+ });
+
+ it('should use serializer if provided', function () {
+ serializer = sinon.stub();
+ params = {foo: 'bar'};
+ serializer.returns('foo=bar');
+ expect(buildURL('/foo', params, serializer)).toEqual('/foo?foo=bar');
+ expect(serializer.calledOnce).toBe(true);
+ expect(serializer.calledWith(params)).toBe(true);
+ });
+
+ it('should support URLSearchParams', function () {
+ expect(buildURL('/foo', new URLSearchParams('bar=baz'))).toEqual('/foo?bar=baz');
+ });
+});
diff --git a/test/specs/helpers/combineURLs.spec.js b/test/specs/helpers/combineURLs.spec.js
new file mode 100644
index 0000000..2a427f5
--- /dev/null
+++ b/test/specs/helpers/combineURLs.spec.js
@@ -0,0 +1,23 @@
+var combineURLs = require('../../../lib/helpers/combineURLs');
+
+describe('helpers::combineURLs', function () {
+ it('should combine URLs', function () {
+ expect(combineURLs('https://api.github.com', '/users')).toBe('https://api.github.com/users');
+ });
+
+ it('should remove duplicate slashes', function () {
+ expect(combineURLs('https://api.github.com/', '/users')).toBe('https://api.github.com/users');
+ });
+
+ it('should insert missing slash', function () {
+ expect(combineURLs('https://api.github.com', 'users')).toBe('https://api.github.com/users');
+ });
+
+ it('should not insert slash when relative url missing/empty', function () {
+ expect(combineURLs('https://api.github.com/users', '')).toBe('https://api.github.com/users');
+ });
+
+ it('should allow a single slash for relative url', function () {
+ expect(combineURLs('https://api.github.com/users', '/')).toBe('https://api.github.com/users/');
+ });
+});
diff --git a/test/specs/helpers/cookies.spec.js b/test/specs/helpers/cookies.spec.js
new file mode 100644
index 0000000..9c3880d
--- /dev/null
+++ b/test/specs/helpers/cookies.spec.js
@@ -0,0 +1,36 @@
+var cookies = require('../../../lib/helpers/cookies');
+
+describe('helpers::cookies', function () {
+ afterEach(function () {
+ // Remove all the cookies
+ var expires = Date.now() - (60 * 60 * 24 * 7);
+ document.cookie.split(';').map(function (cookie) {
+ return cookie.split('=')[0];
+ }).forEach(function (name) {
+ document.cookie = name + '=; expires=' + new Date(expires).toGMTString();
+ });
+ });
+
+ it('should write cookies', function () {
+ cookies.write('foo', 'baz');
+ expect(document.cookie).toEqual('foo=baz');
+ });
+
+ it('should read cookies', function () {
+ cookies.write('foo', 'abc');
+ cookies.write('bar', 'def');
+ expect(cookies.read('foo')).toEqual('abc');
+ expect(cookies.read('bar')).toEqual('def');
+ });
+
+ it('should remove cookies', function () {
+ cookies.write('foo', 'bar');
+ cookies.remove('foo');
+ expect(cookies.read('foo')).toEqual(null);
+ });
+
+ it('should uri encode values', function () {
+ cookies.write('foo', 'bar baz%');
+ expect(document.cookie).toEqual('foo=bar%20baz%25');
+ });
+});
diff --git a/test/specs/helpers/isAbsoluteURL.spec.js b/test/specs/helpers/isAbsoluteURL.spec.js
new file mode 100644
index 0000000..0af4139
--- /dev/null
+++ b/test/specs/helpers/isAbsoluteURL.spec.js
@@ -0,0 +1,23 @@
+var isAbsoluteURL = require('../../../lib/helpers/isAbsoluteURL');
+
+describe('helpers::isAbsoluteURL', function () {
+ it('should return true if URL begins with valid scheme name', function () {
+ expect(isAbsoluteURL('https://api.github.com/users')).toBe(true);
+ expect(isAbsoluteURL('custom-scheme-v1.0://example.com/')).toBe(true);
+ expect(isAbsoluteURL('HTTP://example.com/')).toBe(true);
+ });
+
+ it('should return false if URL begins with invalid scheme name', function () {
+ expect(isAbsoluteURL('123://example.com/')).toBe(false);
+ expect(isAbsoluteURL('!valid://example.com/')).toBe(false);
+ });
+
+ it('should return true if URL is protocol-relative', function () {
+ expect(isAbsoluteURL('//example.com/')).toBe(true);
+ });
+
+ it('should return false if URL is relative', function () {
+ expect(isAbsoluteURL('/foo')).toBe(false);
+ expect(isAbsoluteURL('foo')).toBe(false);
+ });
+});
diff --git a/test/specs/helpers/isAxiosError.spec.js b/test/specs/helpers/isAxiosError.spec.js
new file mode 100644
index 0000000..7aeef85
--- /dev/null
+++ b/test/specs/helpers/isAxiosError.spec.js
@@ -0,0 +1,20 @@
+var createError = require('../../../lib/core/createError');
+var enhanceError = require('../../../lib/core/enhanceError');
+var isAxiosError = require('../../../lib/helpers/isAxiosError');
+
+describe('helpers::isAxiosError', function () {
+ it('should return true if the error is created by core::createError', function () {
+ expect(isAxiosError(createError('Boom!', { foo: 'bar' })))
+ .toBe(true);
+ });
+
+ it('should return true if the error is enhanced by core::enhanceError', function () {
+ expect(isAxiosError(enhanceError(new Error('Boom!'), { foo: 'bar' })))
+ .toBe(true);
+ });
+
+ it('should return false if the error is a normal Error instance', function () {
+ expect(isAxiosError(new Error('Boom!')))
+ .toBe(false);
+ });
+});
diff --git a/test/specs/helpers/isURLSameOrigin.spec.js b/test/specs/helpers/isURLSameOrigin.spec.js
new file mode 100644
index 0000000..c26c770
--- /dev/null
+++ b/test/specs/helpers/isURLSameOrigin.spec.js
@@ -0,0 +1,11 @@
+var isURLSameOrigin = require('../../../lib/helpers/isURLSameOrigin');
+
+describe('helpers::isURLSameOrigin', function () {
+ it('should detect same origin', function () {
+ expect(isURLSameOrigin(window.location.href)).toEqual(true);
+ });
+
+ it('should detect different origin', function () {
+ expect(isURLSameOrigin('https://github.com/axios/axios')).toEqual(false);
+ });
+});
diff --git a/test/specs/helpers/normalizeHeaderName.spec.js b/test/specs/helpers/normalizeHeaderName.spec.js
new file mode 100644
index 0000000..d8d5e82
--- /dev/null
+++ b/test/specs/helpers/normalizeHeaderName.spec.js
@@ -0,0 +1,21 @@
+var normalizeHeaderName = require('../../../lib/helpers/normalizeHeaderName');
+
+describe('helpers::normalizeHeaderName', function () {
+ it('should normalize matching header name', function () {
+ var headers = {
+ 'conTenT-Type': 'foo/bar',
+ };
+ normalizeHeaderName(headers, 'Content-Type');
+ expect(headers['Content-Type']).toBe('foo/bar');
+ expect(headers['conTenT-Type']).toBeUndefined();
+ });
+
+ it('should not change non-matching header name', function () {
+ var headers = {
+ 'content-type': 'foo/bar',
+ };
+ normalizeHeaderName(headers, 'Content-Length');
+ expect(headers['content-type']).toBe('foo/bar');
+ expect(headers['Content-Length']).toBeUndefined();
+ });
+});
diff --git a/test/specs/helpers/parseHeaders.spec.js b/test/specs/helpers/parseHeaders.spec.js
new file mode 100644
index 0000000..254d1d6
--- /dev/null
+++ b/test/specs/helpers/parseHeaders.spec.js
@@ -0,0 +1,45 @@
+var parseHeaders = require('../../../lib/helpers/parseHeaders');
+
+describe('helpers::parseHeaders', function () {
+ it('should parse headers', function () {
+ var date = new Date();
+ var parsed = parseHeaders(
+ 'Date: ' + date.toISOString() + '\n' +
+ 'Content-Type: application/json\n' +
+ 'Connection: keep-alive\n' +
+ 'Transfer-Encoding: chunked'
+ );
+
+ expect(parsed['date']).toEqual(date.toISOString());
+ expect(parsed['content-type']).toEqual('application/json');
+ expect(parsed['connection']).toEqual('keep-alive');
+ expect(parsed['transfer-encoding']).toEqual('chunked');
+ });
+
+ it('should use array for set-cookie', function() {
+ var parsedZero = parseHeaders('');
+ var parsedSingle = parseHeaders(
+ 'Set-Cookie: key=val;'
+ );
+ var parsedMulti = parseHeaders(
+ 'Set-Cookie: key=val;\n' +
+ 'Set-Cookie: key2=val2;\n'
+ );
+
+ expect(parsedZero['set-cookie']).toBeUndefined();
+ expect(parsedSingle['set-cookie']).toEqual(['key=val;']);
+ expect(parsedMulti['set-cookie']).toEqual(['key=val;', 'key2=val2;']);
+ });
+
+ it('should handle duplicates', function() {
+ var parsed = parseHeaders(
+ 'Age: age-a\n' + // age is in ignore duplicates blocklist
+ 'Age: age-b\n' +
+ 'Foo: foo-a\n' +
+ 'Foo: foo-b\n'
+ );
+
+ expect(parsed['age']).toEqual('age-a');
+ expect(parsed['foo']).toEqual('foo-a, foo-b');
+ });
+});
diff --git a/test/specs/helpers/spread.spec.js b/test/specs/helpers/spread.spec.js
new file mode 100644
index 0000000..702063b
--- /dev/null
+++ b/test/specs/helpers/spread.spec.js
@@ -0,0 +1,21 @@
+var spread = require('../../../lib/helpers/spread');
+
+describe('helpers::spread', function () {
+ it('should spread array to arguments', function () {
+ var value = 0;
+ spread(function (a, b) {
+ value = a * b;
+ })([5, 10]);
+
+ expect(value).toEqual(50);
+ });
+
+ it('should return callback result', function () {
+ var value = spread(function (a, b) {
+ return a * b;
+ })([5, 10]);
+
+ expect(value).toEqual(50);
+ });
+});
+
diff --git a/test/specs/instance.spec.js b/test/specs/instance.spec.js
new file mode 100644
index 0000000..bd9e9fb
--- /dev/null
+++ b/test/specs/instance.spec.js
@@ -0,0 +1,114 @@
+describe('instance', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should have the same methods as default instance', function () {
+ var instance = axios.create();
+
+ for (var prop in axios) {
+ if ([
+ 'Axios',
+ 'create',
+ 'Cancel',
+ 'CancelToken',
+ 'isCancel',
+ 'all',
+ 'spread',
+ 'isAxiosError',
+ 'default'].indexOf(prop) > -1) {
+ continue;
+ }
+ expect(typeof instance[prop]).toBe(typeof axios[prop]);
+ }
+ });
+
+ it('should make an http request without verb helper', function (done) {
+ var instance = axios.create();
+
+ instance('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+
+ it('should make an http request with url instead of baseURL', function (done) {
+ var instance = axios.create({
+ url: 'https://api.example.com'
+ });
+
+ instance('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+
+ it('should make an http request', function (done) {
+ var instance = axios.create();
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+
+ it('should use instance options', function (done) {
+ var instance = axios.create({ timeout: 1000 });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.timeout).toBe(1000);
+ done();
+ });
+ });
+
+ it('should have defaults.headers', function () {
+ var instance = axios.create({
+ baseURL: 'https://api.example.com'
+ });
+
+ expect(typeof instance.defaults.headers, 'object');
+ expect(typeof instance.defaults.headers.common, 'object');
+ });
+
+ it('should have interceptors on the instance', function (done) {
+ axios.interceptors.request.use(function (config) {
+ config.foo = true;
+ return config;
+ });
+
+ var instance = axios.create();
+ instance.interceptors.request.use(function (config) {
+ config.bar = true;
+ return config;
+ });
+
+ var response;
+ instance.get('/foo').then(function (res) {
+ response = res;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200
+ });
+
+ setTimeout(function () {
+ expect(response.config.foo).toEqual(undefined);
+ expect(response.config.bar).toEqual(true);
+ done();
+ }, 100);
+ });
+ });
+});
diff --git a/test/specs/interceptors.spec.js b/test/specs/interceptors.spec.js
new file mode 100644
index 0000000..effbcde
--- /dev/null
+++ b/test/specs/interceptors.spec.js
@@ -0,0 +1,273 @@
+describe('interceptors', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ axios.interceptors.request.handlers = [];
+ axios.interceptors.response.handlers = [];
+ });
+
+ it('should add a request interceptor', function (done) {
+ axios.interceptors.request.use(function (config) {
+ config.headers.test = 'added by interceptor';
+ return config;
+ });
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ expect(request.requestHeaders.test).toBe('added by interceptor');
+ done();
+ });
+ });
+
+ it('should add a request interceptor that returns a new config object', function (done) {
+ axios.interceptors.request.use(function () {
+ return {
+ url: '/bar',
+ method: 'post'
+ };
+ });
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.method).toBe('POST');
+ expect(request.url).toBe('/bar');
+ done();
+ });
+ });
+
+ it('should add a request interceptor that returns a promise', function (done) {
+ axios.interceptors.request.use(function (config) {
+ return new Promise(function (resolve) {
+ // do something async
+ setTimeout(function () {
+ config.headers.async = 'promise';
+ resolve(config);
+ }, 100);
+ });
+ });
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders.async).toBe('promise');
+ done();
+ });
+ });
+
+ it('should add multiple request interceptors', function (done) {
+ axios.interceptors.request.use(function (config) {
+ config.headers.test1 = '1';
+ return config;
+ });
+ axios.interceptors.request.use(function (config) {
+ config.headers.test2 = '2';
+ return config;
+ });
+ axios.interceptors.request.use(function (config) {
+ config.headers.test3 = '3';
+ return config;
+ });
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders.test1).toBe('1');
+ expect(request.requestHeaders.test2).toBe('2');
+ expect(request.requestHeaders.test3).toBe('3');
+ done();
+ });
+ });
+
+ it('should add a response interceptor', function (done) {
+ var response;
+
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + ' - modified by interceptor';
+ return data;
+ });
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ setTimeout(function () {
+ expect(response.data).toBe('OK - modified by interceptor');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should add a response interceptor that returns a new data object', function (done) {
+ var response;
+
+ axios.interceptors.response.use(function () {
+ return {
+ data: 'stuff'
+ };
+ });
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ setTimeout(function () {
+ expect(response.data).toBe('stuff');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should add a response interceptor that returns a promise', function (done) {
+ var response;
+
+ axios.interceptors.response.use(function (data) {
+ return new Promise(function (resolve) {
+ // do something async
+ setTimeout(function () {
+ data.data = 'you have been promised!';
+ resolve(data);
+ }, 10);
+ });
+ });
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ setTimeout(function () {
+ expect(response.data).toBe('you have been promised!');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should add multiple response interceptors', function (done) {
+ var response;
+
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + '1';
+ return data;
+ });
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + '2';
+ return data;
+ });
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + '3';
+ return data;
+ });
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ setTimeout(function () {
+ expect(response.data).toBe('OK123');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should allow removing interceptors', function (done) {
+ var response, intercept;
+
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + '1';
+ return data;
+ });
+ intercept = axios.interceptors.response.use(function (data) {
+ data.data = data.data + '2';
+ return data;
+ });
+ axios.interceptors.response.use(function (data) {
+ data.data = data.data + '3';
+ return data;
+ });
+
+ axios.interceptors.response.eject(intercept);
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: 'OK'
+ });
+
+ setTimeout(function () {
+ expect(response.data).toBe('OK13');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should execute interceptors before transformers', function (done) {
+ axios.interceptors.request.use(function (config) {
+ config.data.baz = 'qux';
+ return config;
+ });
+
+ axios.post('/foo', {
+ foo: 'bar'
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.params).toEqual('{"foo":"bar","baz":"qux"}');
+ done();
+ });
+ });
+
+ it('should modify base URL in request interceptor', function (done) {
+ var instance = axios.create({
+ baseURL: 'http://test.com/'
+ });
+
+ instance.interceptors.request.use(function (config) {
+ config.baseURL = 'http://rebase.com/';
+ return config;
+ });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://rebase.com/foo');
+ done();
+ });
+ });
+});
diff --git a/test/specs/options.spec.js b/test/specs/options.spec.js
new file mode 100644
index 0000000..762b851
--- /dev/null
+++ b/test/specs/options.spec.js
@@ -0,0 +1,112 @@
+describe('options', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should default method to get', function (done) {
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.method).toBe('GET');
+ done();
+ });
+ });
+
+ it('should accept headers', function (done) {
+ axios('/foo', {
+ headers: {
+ 'X-Requested-With': 'XMLHttpRequest'
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['X-Requested-With']).toEqual('XMLHttpRequest');
+ done();
+ });
+ });
+
+ it('should accept params', function (done) {
+ axios('/foo', {
+ params: {
+ foo: 123,
+ bar: 456
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo?foo=123&bar=456');
+ done();
+ });
+ });
+
+ it('should allow overriding default headers', function (done) {
+ axios('/foo', {
+ headers: {
+ 'Accept': 'foo/bar'
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['Accept']).toEqual('foo/bar');
+ done();
+ });
+ });
+
+ it('should accept base URL', function (done) {
+ var instance = axios.create({
+ baseURL: 'http://test.com/'
+ });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://test.com/foo');
+ done();
+ });
+ });
+
+ it('should ignore base URL if request URL is absolute', function (done) {
+ var instance = axios.create({
+ baseURL: 'http://someurl.com/'
+ });
+
+ instance.get('http://someotherurl.com/');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('http://someotherurl.com/');
+ done();
+ });
+ });
+
+ it('should change only the baseURL of the specified instance', function() {
+ var instance1 = axios.create();
+ var instance2 = axios.create();
+
+ instance1.defaults.baseURL = 'http://instance1.example.com/';
+
+ expect(instance2.defaults.baseURL).not.toBe('http://instance1.example.com/');
+ });
+
+ it('should change only the headers of the specified instance', function() {
+ var instance1 = axios.create();
+ var instance2 = axios.create();
+
+ instance1.defaults.headers.common.Authorization = 'faketoken';
+ instance2.defaults.headers.common.Authorization = 'differentfaketoken';
+
+ instance1.defaults.headers.common['Content-Type'] = 'application/xml';
+ instance2.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded';
+
+ expect(axios.defaults.headers.common.Authorization).toBe(undefined);
+ expect(instance1.defaults.headers.common.Authorization).toBe('faketoken');
+ expect(instance2.defaults.headers.common.Authorization).toBe('differentfaketoken');
+
+ expect(axios.defaults.headers.common['Content-Type']).toBe(undefined);
+ expect(instance1.defaults.headers.common['Content-Type']).toBe('application/xml');
+ expect(instance2.defaults.headers.common['Content-Type']).toBe('application/x-www-form-urlencoded');
+ });
+});
diff --git a/test/specs/progress.spec.js b/test/specs/progress.spec.js
new file mode 100644
index 0000000..287b4dd
--- /dev/null
+++ b/test/specs/progress.spec.js
@@ -0,0 +1,111 @@
+describe('progress events', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should add a download progress handler', function (done) {
+ var progressSpy = jasmine.createSpy('progress');
+
+ axios('/foo', { onDownloadProgress: progressSpy } );
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: '{"foo": "bar"}'
+ });
+ expect(progressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should add a upload progress handler', function (done) {
+ var progressSpy = jasmine.createSpy('progress');
+
+ axios('/foo', { onUploadProgress: progressSpy } );
+
+ getAjaxRequest().then(function (request) {
+ // Jasmine AJAX doesn't trigger upload events. Waiting for upstream fix
+ // expect(progressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should add both upload and download progress handlers', function (done) {
+ var downloadProgressSpy = jasmine.createSpy('downloadProgress');
+ var uploadProgressSpy = jasmine.createSpy('uploadProgress');
+
+ axios('/foo', { onDownloadProgress: downloadProgressSpy, onUploadProgress: uploadProgressSpy });
+
+ getAjaxRequest().then(function (request) {
+ // expect(uploadProgressSpy).toHaveBeenCalled();
+ expect(downloadProgressSpy).not.toHaveBeenCalled();
+ request.respondWith({
+ status: 200,
+ responseText: '{"foo": "bar"}'
+ });
+ expect(downloadProgressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should add a download progress handler from instance config', function (done) {
+ var progressSpy = jasmine.createSpy('progress');
+
+ var instance = axios.create({
+ onDownloadProgress: progressSpy,
+ });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: '{"foo": "bar"}'
+ });
+ expect(progressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should add a upload progress handler from instance config', function (done) {
+ var progressSpy = jasmine.createSpy('progress');
+
+ var instance = axios.create({
+ onUploadProgress: progressSpy,
+ });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ // expect(progressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should add upload and download progress handlers from instance config', function (done) {
+ var downloadProgressSpy = jasmine.createSpy('downloadProgress');
+ var uploadProgressSpy = jasmine.createSpy('uploadProgress');
+
+ var instance = axios.create({
+ onDownloadProgress: downloadProgressSpy,
+ onUploadProgress: uploadProgressSpy,
+ });
+
+ instance.get('/foo');
+
+ getAjaxRequest().then(function (request) {
+ // expect(uploadProgressSpy).toHaveBeenCalled();
+ expect(downloadProgressSpy).not.toHaveBeenCalled();
+ request.respondWith({
+ status: 200,
+ responseText: '{"foo": "bar"}'
+ });
+ expect(downloadProgressSpy).toHaveBeenCalled();
+ done();
+ });
+ });
+});
diff --git a/test/specs/promise.spec.js b/test/specs/promise.spec.js
new file mode 100644
index 0000000..ffc17ce
--- /dev/null
+++ b/test/specs/promise.spec.js
@@ -0,0 +1,70 @@
+describe('promise', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should provide succinct object to then', function (done) {
+ var response;
+
+ axios('/foo').then(function (r) {
+ response = r;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: '{"hello":"world"}'
+ });
+
+ setTimeout(function () {
+ expect(typeof response).toEqual('object');
+ expect(response.data.hello).toEqual('world');
+ expect(response.status).toEqual(200);
+ expect(response.headers['content-type']).toEqual('application/json');
+ expect(response.config.url).toEqual('/foo');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should support all', function (done) {
+ var fulfilled = false;
+
+ axios.all([true, 123]).then(function () {
+ fulfilled = true;
+ });
+
+ setTimeout(function () {
+ expect(fulfilled).toEqual(true);
+ done();
+ }, 100);
+ });
+
+ it('should support spread', function (done) {
+ var sum = 0;
+ var fulfilled = false;
+ var result;
+
+ axios
+ .all([123, 456])
+ .then(axios.spread(function (a, b) {
+ sum = a + b;
+ fulfilled = true;
+ return 'hello world';
+ }))
+ .then(function (res) {
+ result = res;
+ });
+
+ setTimeout(function () {
+ expect(fulfilled).toEqual(true);
+ expect(sum).toEqual(123 + 456);
+ expect(result).toEqual('hello world');
+ done();
+ }, 100);
+ });
+});
diff --git a/test/specs/requests.spec.js b/test/specs/requests.spec.js
new file mode 100644
index 0000000..692dbb0
--- /dev/null
+++ b/test/specs/requests.spec.js
@@ -0,0 +1,439 @@
+describe('requests', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should treat single string arg as url', function (done) {
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ expect(request.method).toBe('GET');
+ done();
+ });
+ });
+
+ it('should treat method value as lowercase string', function (done) {
+ axios({
+ url: '/foo',
+ method: 'POST'
+ }).then(function (response) {
+ expect(response.config.method).toBe('post');
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200
+ });
+ });
+ });
+
+ it('should allow string arg as url, and config arg', function (done) {
+ axios.post('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ expect(request.method).toBe('POST');
+ done();
+ });
+ });
+
+ it('should allow data', function (done) {
+ axios.delete('/foo', {
+ data: { foo: 'bar' }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.params).toBe(JSON.stringify({ foo: 'bar' }));
+ done();
+ });
+ });
+
+ it('should make an http request', function (done) {
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.url).toBe('/foo');
+ done();
+ });
+ });
+
+ it('should reject on network errors', function (done) {
+ // disable jasmine.Ajax since we're hitting a non-existent server anyway
+ jasmine.Ajax.uninstall();
+
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ var finish = function () {
+ expect(resolveSpy).not.toHaveBeenCalled();
+ expect(rejectSpy).toHaveBeenCalled();
+ var reason = rejectSpy.calls.first().args[0];
+ expect(reason instanceof Error).toBe(true);
+ expect(reason.config.method).toBe('get');
+ expect(reason.config.url).toBe('http://thisisnotaserver/foo');
+ expect(reason.request).toEqual(jasmine.any(XMLHttpRequest));
+
+ // re-enable jasmine.Ajax
+ jasmine.Ajax.install();
+
+ done();
+ };
+
+ axios('http://thisisnotaserver/foo')
+ .then(resolveSpy, rejectSpy)
+ .then(finish, finish);
+ });
+
+ it('should reject on abort', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ var finish = function () {
+ expect(resolveSpy).not.toHaveBeenCalled();
+ expect(rejectSpy).toHaveBeenCalled();
+ var reason = rejectSpy.calls.first().args[0];
+ expect(reason instanceof Error).toBe(true);
+ expect(reason.config.method).toBe('get');
+ expect(reason.config.url).toBe('/foo');
+ expect(reason.request).toEqual(jasmine.any(XMLHttpRequest));
+
+ done();
+ };
+
+ axios('/foo')
+ .then(resolveSpy, rejectSpy)
+ .then(finish, finish);
+
+ getAjaxRequest().then(function (request) {
+ request.abort();
+ });
+ });
+
+ it('should reject when validateStatus returns false', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ axios('/foo', {
+ validateStatus: function (status) {
+ return status !== 500;
+ }
+ }).then(resolveSpy)
+ .catch(rejectSpy)
+ .then(function () {
+ expect(resolveSpy).not.toHaveBeenCalled();
+ expect(rejectSpy).toHaveBeenCalled();
+ var reason = rejectSpy.calls.first().args[0];
+ expect(reason instanceof Error).toBe(true);
+ expect(reason.message).toBe('Request failed with status code 500');
+ expect(reason.config.method).toBe('get');
+ expect(reason.config.url).toBe('/foo');
+ expect(reason.response.status).toBe(500);
+
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 500
+ });
+ });
+ });
+
+ it('should resolve when validateStatus returns true', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ axios('/foo', {
+ validateStatus: function (status) {
+ return status === 500;
+ }
+ }).then(resolveSpy)
+ .catch(rejectSpy)
+ .then(function () {
+ expect(resolveSpy).toHaveBeenCalled();
+ expect(rejectSpy).not.toHaveBeenCalled();
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 500
+ });
+ });
+ });
+
+ it('should resolve when the response status is 0 (i.e. requesting with file protocol)', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ axios('file:///xxx').then(resolveSpy)
+ .catch(rejectSpy)
+ .then(function () {
+ expect(resolveSpy).toHaveBeenCalled();
+ expect(rejectSpy).not.toHaveBeenCalled();
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 0,
+ responseURL: 'file:///xxx',
+ });
+ });
+ });
+
+ it('should resolve when validateStatus is null', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ axios('/foo', {
+ validateStatus: null
+ }).then(resolveSpy)
+ .catch(rejectSpy)
+ .then(function () {
+ expect(resolveSpy).toHaveBeenCalled();
+ expect(rejectSpy).not.toHaveBeenCalled();
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 500
+ });
+ });
+ });
+
+ it('should resolve when validateStatus is undefined', function (done) {
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ axios('/foo', {
+ validateStatus: undefined
+ }).then(resolveSpy)
+ .catch(rejectSpy)
+ .then(function () {
+ expect(resolveSpy).toHaveBeenCalled();
+ expect(rejectSpy).not.toHaveBeenCalled();
+ done();
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 500
+ });
+ });
+ });
+
+ // https://github.com/axios/axios/issues/378
+ it('should return JSON when rejecting', function (done) {
+ var response;
+
+ axios('/api/account/signup', {
+ username: null,
+ password: null
+ }, {
+ method: 'post',
+ headers: {
+ 'Accept': 'application/json'
+ }
+ })
+ .catch(function (error) {
+ response = error.response;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 400,
+ statusText: 'Bad Request',
+ responseText: '{"error": "BAD USERNAME", "code": 1}'
+ });
+
+ setTimeout(function () {
+ expect(typeof response.data).toEqual('object');
+ expect(response.data.error).toEqual('BAD USERNAME');
+ expect(response.data.code).toEqual(1);
+ done();
+ }, 100);
+ });
+ });
+
+ it('should make cross domain http request', function (done) {
+ var response;
+
+ axios.post('www.someurl.com/foo').then(function(res){
+ response = res;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ statusText: 'OK',
+ responseText: '{"foo": "bar"}',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ });
+
+ setTimeout(function () {
+ expect(response.data.foo).toEqual('bar');
+ expect(response.status).toEqual(200);
+ expect(response.statusText).toEqual('OK');
+ expect(response.headers['content-type']).toEqual('application/json');
+ done();
+ }, 100);
+ });
+ });
+
+
+ it('should supply correct response', function (done) {
+ var response;
+
+ axios.post('/foo').then(function (res) {
+ response = res;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ statusText: 'OK',
+ responseText: '{"foo": "bar"}',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ });
+
+ setTimeout(function () {
+ expect(response.data.foo).toEqual('bar');
+ expect(response.status).toEqual(200);
+ expect(response.statusText).toEqual('OK');
+ expect(response.headers['content-type']).toEqual('application/json');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should not modify the config url with relative baseURL', function (done) {
+ var config;
+
+ axios.get('/foo', {
+ baseURL: '/api'
+ }).catch(function (error) {
+ config = error.config;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 404,
+ statusText: 'NOT FOUND',
+ responseText: 'Resource not found'
+ });
+
+ setTimeout(function () {
+ expect(config.baseURL).toEqual('/api');
+ expect(config.url).toEqual('/foo');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should allow overriding Content-Type header case-insensitive', function (done) {
+ var response;
+ var contentType = 'application/vnd.myapp.type+json';
+
+ axios.post('/foo', { prop: 'value' }, {
+ headers: {
+ 'content-type': contentType
+ }
+ }).then(function (res) {
+ response = res;
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['Content-Type']).toEqual(contentType);
+ done();
+ });
+ });
+
+ it('should support binary data as array buffer', function (done) {
+ var input = new Int8Array(2);
+ input[0] = 1;
+ input[1] = 2;
+
+ axios.post('/foo', input.buffer);
+
+ getAjaxRequest().then(function (request) {
+ var output = new Int8Array(request.params);
+ expect(output.length).toEqual(2);
+ expect(output[0]).toEqual(1);
+ expect(output[1]).toEqual(2);
+ done();
+ });
+ });
+
+ it('should support binary data as array buffer view', function (done) {
+ var input = new Int8Array(2);
+ input[0] = 1;
+ input[1] = 2;
+
+ axios.post('/foo', input);
+
+ getAjaxRequest().then(function (request) {
+ var output = new Int8Array(request.params);
+ expect(output.length).toEqual(2);
+ expect(output[0]).toEqual(1);
+ expect(output[1]).toEqual(2);
+ done();
+ });
+ });
+
+ it('should support array buffer response', function (done) {
+ var response;
+
+ function str2ab(str) {
+ var buff = new ArrayBuffer(str.length * 2);
+ var view = new Uint16Array(buff);
+ for ( var i=0, l=str.length; i<l; i++) {
+ view[i] = str.charCodeAt(i);
+ }
+ return buff;
+ }
+
+ axios('/foo', {
+ responseType: 'arraybuffer'
+ }).then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ response: str2ab('Hello world')
+ });
+
+ setTimeout(function () {
+ expect(response.data.byteLength).toBe(22);
+ done();
+ }, 100);
+ });
+ });
+
+ it('should support URLSearchParams', function (done) {
+ var params = new URLSearchParams();
+ params.append('param1', 'value1');
+ params.append('param2', 'value2');
+
+ axios.post('/foo', params);
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['Content-Type']).toBe('application/x-www-form-urlencoded;charset=utf-8');
+ expect(request.params).toBe('param1=value1&param2=value2');
+ done();
+ });
+ });
+});
diff --git a/test/specs/transform.spec.js b/test/specs/transform.spec.js
new file mode 100644
index 0000000..5199ecb
--- /dev/null
+++ b/test/specs/transform.spec.js
@@ -0,0 +1,94 @@
+describe('transform', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should transform JSON to string', function (done) {
+ var data = {
+ foo: 'bar'
+ };
+
+ axios.post('/foo', data);
+
+ getAjaxRequest().then(function (request) {
+ expect(request.params).toEqual('{"foo":"bar"}');
+ done();
+ });
+ });
+
+ it('should transform string to JSON', function (done) {
+ var response;
+
+ axios('/foo').then(function (data) {
+ response = data;
+ });
+
+ getAjaxRequest().then(function (request) {
+ request.respondWith({
+ status: 200,
+ responseText: '{"foo": "bar"}'
+ });
+
+ setTimeout(function () {
+ expect(typeof response.data).toEqual('object');
+ expect(response.data.foo).toEqual('bar');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should override default transform', function (done) {
+ var data = {
+ foo: 'bar'
+ };
+
+ axios.post('/foo', data, {
+ transformRequest: function (data) {
+ return data;
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(typeof request.params).toEqual('object');
+ done();
+ });
+ });
+
+ it('should allow an Array of transformers', function (done) {
+ var data = {
+ foo: 'bar'
+ };
+
+ axios.post('/foo', data, {
+ transformRequest: axios.defaults.transformRequest.concat(
+ function (data) {
+ return data.replace('bar', 'baz');
+ }
+ )
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.params).toEqual('{"foo":"baz"}');
+ done();
+ });
+ });
+
+ it('should allowing mutating headers', function (done) {
+ var token = Math.floor(Math.random() * Math.pow(2, 64)).toString(36);
+
+ axios('/foo', {
+ transformRequest: function (data, headers) {
+ headers['X-Authorization'] = token;
+ }
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders['X-Authorization']).toEqual(token);
+ done();
+ });
+ });
+});
diff --git a/test/specs/utils/extend.spec.js b/test/specs/utils/extend.spec.js
new file mode 100644
index 0000000..3e1bb32
--- /dev/null
+++ b/test/specs/utils/extend.spec.js
@@ -0,0 +1,34 @@
+var extend = require('../../../lib/utils').extend;
+
+describe('utils::extend', function () {
+ it('should be mutable', function () {
+ var a = {};
+ var b = {foo: 123};
+
+ extend(a, b);
+
+ expect(a.foo).toEqual(b.foo);
+ });
+
+ it('should extend properties', function () {
+ var a = {foo: 123, bar: 456};
+ var b = {bar: 789};
+
+ a = extend(a, b);
+
+ expect(a.foo).toEqual(123);
+ expect(a.bar).toEqual(789);
+ });
+
+ it('should bind to thisArg', function () {
+ var a = {};
+ var b = {getFoo: function getFoo() { return this.foo; }};
+ var thisArg = { foo: 'barbaz' };
+
+ extend(a, b, thisArg);
+
+ expect(typeof a.getFoo).toEqual('function');
+ expect(a.getFoo()).toEqual(thisArg.foo);
+ });
+});
+
diff --git a/test/specs/utils/forEach.spec.js b/test/specs/utils/forEach.spec.js
new file mode 100644
index 0000000..5f28399
--- /dev/null
+++ b/test/specs/utils/forEach.spec.js
@@ -0,0 +1,63 @@
+var forEach = require('../../../lib/utils').forEach;
+
+describe('utils::forEach', function () {
+ it('should loop over an array', function () {
+ var sum = 0;
+
+ forEach([1, 2, 3, 4, 5], function (val) {
+ sum += val;
+ });
+
+ expect(sum).toEqual(15);
+ });
+
+ it('should loop over object keys', function () {
+ var keys = '';
+ var vals = 0;
+ var obj = {
+ b: 1,
+ a: 2,
+ r: 3
+ };
+
+ forEach(obj, function (v, k) {
+ keys += k;
+ vals += v;
+ });
+
+ expect(keys).toEqual('bar');
+ expect(vals).toEqual(6);
+ });
+
+ it('should handle undefined gracefully', function () {
+ var count = 0;
+
+ forEach(undefined, function () {
+ count++;
+ });
+
+ expect(count).toEqual(0);
+ });
+
+ it('should make an array out of non-array argument', function () {
+ var count = 0;
+
+ forEach(function () {}, function () {
+ count++;
+ });
+
+ expect(count).toEqual(1);
+ });
+
+ it('should handle non object prototype gracefully', function () {
+ var count = 0;
+ var data = Object.create(null);
+ data.foo = 'bar'
+
+ forEach(data, function () {
+ count++;
+ });
+
+ expect(count).toEqual(1);
+ });
+});
diff --git a/test/specs/utils/isX.spec.js b/test/specs/utils/isX.spec.js
new file mode 100644
index 0000000..59b3168
--- /dev/null
+++ b/test/specs/utils/isX.spec.js
@@ -0,0 +1,80 @@
+var utils = require('../../../lib/utils');
+var Stream = require('stream');
+
+describe('utils::isX', function () {
+ it('should validate Array', function () {
+ expect(utils.isArray([])).toEqual(true);
+ expect(utils.isArray({length: 5})).toEqual(false);
+ });
+
+ it('should validate Buffer', function () {
+ expect(utils.isBuffer(Buffer.from('a'))).toEqual(true);
+ expect(utils.isBuffer(null)).toEqual(false);
+ expect(utils.isBuffer(undefined)).toEqual(false);
+ });
+
+ it('should validate ArrayBuffer', function () {
+ expect(utils.isArrayBuffer(new ArrayBuffer(2))).toEqual(true);
+ expect(utils.isArrayBuffer({})).toEqual(false);
+ });
+
+ it('should validate ArrayBufferView', function () {
+ expect(utils.isArrayBufferView(new DataView(new ArrayBuffer(2)))).toEqual(true);
+ });
+
+ it('should validate FormData', function () {
+ expect(utils.isFormData(new FormData())).toEqual(true);
+ });
+
+ it('should validate Blob', function () {
+ expect(utils.isBlob(new Blob())).toEqual(true);
+ });
+
+ it('should validate String', function () {
+ expect(utils.isString('')).toEqual(true);
+ expect(utils.isString({toString: function () { return ''; }})).toEqual(false);
+ });
+
+ it('should validate Number', function () {
+ expect(utils.isNumber(123)).toEqual(true);
+ expect(utils.isNumber('123')).toEqual(false);
+ });
+
+ it('should validate Undefined', function () {
+ expect(utils.isUndefined()).toEqual(true);
+ expect(utils.isUndefined(null)).toEqual(false);
+ });
+
+ it('should validate Object', function () {
+ expect(utils.isObject({})).toEqual(true);
+ expect(utils.isObject([])).toEqual(true);
+ expect(utils.isObject(null)).toEqual(false);
+ });
+
+ it('should validate plain Object', function () {
+ expect(utils.isPlainObject({})).toEqual(true);
+ expect(utils.isPlainObject([])).toEqual(false);
+ expect(utils.isPlainObject(null)).toEqual(false);
+ expect(utils.isPlainObject(Object.create({}))).toEqual(false);
+ });
+
+ it('should validate Date', function () {
+ expect(utils.isDate(new Date())).toEqual(true);
+ expect(utils.isDate(Date.now())).toEqual(false);
+ });
+
+ it('should validate Function', function () {
+ expect(utils.isFunction(function () {})).toEqual(true);
+ expect(utils.isFunction('function')).toEqual(false);
+ });
+
+ it('should validate Stream', function () {
+ expect(utils.isStream(new Stream.Readable())).toEqual(true);
+ expect(utils.isStream({ foo: 'bar' })).toEqual(false);
+ });
+
+ it('should validate URLSearchParams', function () {
+ expect(utils.isURLSearchParams(new URLSearchParams())).toEqual(true);
+ expect(utils.isURLSearchParams('foo=1&bar=2')).toEqual(false);
+ });
+});
diff --git a/test/specs/utils/merge.spec.js b/test/specs/utils/merge.spec.js
new file mode 100644
index 0000000..efe844a
--- /dev/null
+++ b/test/specs/utils/merge.spec.js
@@ -0,0 +1,84 @@
+var merge = require('../../../lib/utils').merge;
+
+describe('utils::merge', function () {
+ it('should be immutable', function () {
+ var a = {};
+ var b = {foo: 123};
+ var c = {bar: 456};
+
+ merge(a, b, c);
+
+ expect(typeof a.foo).toEqual('undefined');
+ expect(typeof a.bar).toEqual('undefined');
+ expect(typeof b.bar).toEqual('undefined');
+ expect(typeof c.foo).toEqual('undefined');
+ });
+
+ it('should merge properties', function () {
+ var a = {foo: 123};
+ var b = {bar: 456};
+ var c = {foo: 789};
+ var d = merge(a, b, c);
+
+ expect(d.foo).toEqual(789);
+ expect(d.bar).toEqual(456);
+ });
+
+ it('should merge recursively', function () {
+ var a = {foo: {bar: 123}};
+ var b = {foo: {baz: 456}, bar: {qux: 789}};
+
+ expect(merge(a, b)).toEqual({
+ foo: {
+ bar: 123,
+ baz: 456
+ },
+ bar: {
+ qux: 789
+ }
+ });
+ });
+
+ it('should remove all references from nested objects', function () {
+ var a = {foo: {bar: 123}};
+ var b = {};
+ var d = merge(a, b);
+
+ expect(d).toEqual({
+ foo: {
+ bar: 123
+ }
+ });
+
+ expect(d.foo).not.toBe(a.foo);
+ });
+
+ it('handles null and undefined arguments', function () {
+ expect(merge(undefined, undefined)).toEqual({});
+ expect(merge(undefined, {foo: 123})).toEqual({foo: 123});
+ expect(merge({foo: 123}, undefined)).toEqual({foo: 123});
+
+ expect(merge(null, null)).toEqual({});
+ expect(merge(null, {foo: 123})).toEqual({foo: 123});
+ expect(merge({foo: 123}, null)).toEqual({foo: 123});
+ });
+
+ it('should replace properties with null', function () {
+ expect(merge({}, {a: null})).toEqual({a: null});
+ expect(merge({a: null}, {})).toEqual({a: null});
+ });
+
+ it('should replace properties with arrays', function () {
+ expect(merge({}, {a: [1, 2, 3]})).toEqual({a: [1, 2, 3]});
+ expect(merge({a: 2}, {a: [1, 2, 3]})).toEqual({a: [1, 2, 3]});
+ expect(merge({a: {b: 2}}, {a: [1, 2, 3]})).toEqual({a: [1, 2, 3]});
+ });
+
+ it('should replace properties with cloned arrays', function () {
+ var a = [1, 2, 3];
+ var d = merge({}, {a: a});
+
+ expect(d).toEqual({a: [1, 2, 3]});
+ expect(d.a).not.toBe(a);
+ });
+});
diff --git a/test/specs/utils/trim.spec.js b/test/specs/utils/trim.spec.js
new file mode 100644
index 0000000..1b45e95
--- /dev/null
+++ b/test/specs/utils/trim.spec.js
@@ -0,0 +1,12 @@
+var trim = require('../../../lib/utils').trim;
+
+describe('utils::trim', function () {
+ it('should trim spaces', function () {
+ expect(trim(' foo ')).toEqual('foo');
+ });
+
+ it('should trim tabs', function () {
+ expect(trim('\tfoo\t')).toEqual('foo');
+ });
+});
+
diff --git a/test/specs/xsrf.spec.js b/test/specs/xsrf.spec.js
new file mode 100644
index 0000000..56cc0d2
--- /dev/null
+++ b/test/specs/xsrf.spec.js
@@ -0,0 +1,82 @@
+var cookies = require('../../lib/helpers/cookies');
+
+describe('xsrf', function () {
+ beforeEach(function () {
+ jasmine.Ajax.install();
+ });
+
+ afterEach(function () {
+ document.cookie = axios.defaults.xsrfCookieName + '=;expires=' + new Date(Date.now() - 86400000).toGMTString();
+ jasmine.Ajax.uninstall();
+ });
+
+ it('should not set xsrf header if cookie is null', function (done) {
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual(undefined);
+ done();
+ });
+ });
+
+ it('should set xsrf header if cookie is set', function (done) {
+ document.cookie = axios.defaults.xsrfCookieName + '=12345';
+
+ axios('/foo');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual('12345');
+ done();
+ });
+ });
+
+ it('should not set xsrf header if xsrfCookieName is null', function (done) {
+ document.cookie = axios.defaults.xsrfCookieName + '=12345';
+
+ axios('/foo', {
+ xsrfCookieName: null
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual(undefined);
+ done();
+ });
+ });
+
+ it('should not read cookies at all if xsrfCookieName is null', function (done) {
+ spyOn(cookies, "read");
+
+ axios('/foo', {
+ xsrfCookieName: null
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(cookies.read).not.toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it('should not set xsrf header for cross origin', function (done) {
+ document.cookie = axios.defaults.xsrfCookieName + '=12345';
+
+ axios('http://example.com/');
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual(undefined);
+ done();
+ });
+ });
+
+ it('should set xsrf header for cross origin when using withCredentials', function (done) {
+ document.cookie = axios.defaults.xsrfCookieName + '=12345';
+
+ axios('http://example.com/', {
+ withCredentials: true
+ });
+
+ getAjaxRequest().then(function (request) {
+ expect(request.requestHeaders[axios.defaults.xsrfHeaderName]).toEqual('12345');
+ done();
+ });
+ });
+});
diff --git a/test/typescript/axios.ts b/test/typescript/axios.ts
new file mode 100644
index 0000000..1a1b6a7
--- /dev/null
+++ b/test/typescript/axios.ts
@@ -0,0 +1,369 @@
+import axios, {
+ AxiosRequestConfig,
+ AxiosResponse,
+ AxiosError,
+ AxiosInstance,
+ AxiosAdapter,
+ Cancel,
+ CancelToken,
+ CancelTokenSource,
+ Canceler
+} from '../../';
+
+const config: AxiosRequestConfig = {
+ url: '/user',
+ method: 'get',
+ baseURL: 'https://api.example.com/',
+ transformRequest: (data: any) => '{"foo":"bar"}',
+ transformResponse: [
+ (data: any) => ({ baz: 'qux' })
+ ],
+ headers: { 'X-FOO': 'bar' },
+ params: { id: 12345 },
+ paramsSerializer: (params: any) => 'id=12345',
+ data: { foo: 'bar' },
+ timeout: 10000,
+ withCredentials: true,
+ auth: {
+ username: 'janedoe',
+ password: 's00pers3cret'
+ },
+ responseType: 'json',
+ xsrfCookieName: 'XSRF-TOKEN',
+ xsrfHeaderName: 'X-XSRF-TOKEN',
+ onUploadProgress: (progressEvent: ProgressEvent) => {},
+ onDownloadProgress: (progressEvent: ProgressEvent) => {},
+ maxContentLength: 2000,
+ maxBodyLength: 2000,
+ validateStatus: (status: number) => status >= 200 && status < 300,
+ maxRedirects: 5,
+ proxy: {
+ host: '127.0.0.1',
+ port: 9000
+ },
+ cancelToken: new axios.CancelToken((cancel: Canceler) => {})
+};
+
+const nullValidateStatusConfig: AxiosRequestConfig = {
+ validateStatus: null
+};
+
+const undefinedValidateStatusConfig: AxiosRequestConfig = {
+ validateStatus: undefined
+};
+
+const handleResponse = (response: AxiosResponse) => {
+ console.log(response.data);
+ console.log(response.status);
+ console.log(response.statusText);
+ console.log(response.headers);
+ console.log(response.config);
+};
+
+const handleError = (error: AxiosError) => {
+ if (error.response) {
+ console.log(error.response.data);
+ console.log(error.response.status);
+ console.log(error.response.headers);
+ } else {
+ console.log(error.message);
+ }
+};
+
+axios(config)
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.get('/user?id=12345')
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.get('/user', { params: { id: 12345 } })
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.head('/user')
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.options('/user')
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.delete('/user')
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.post('/user', { foo: 'bar' })
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.post('/user', { foo: 'bar' }, { headers: { 'X-FOO': 'bar' } })
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.put('/user', { foo: 'bar' })
+ .then(handleResponse)
+ .catch(handleError);
+
+axios.patch('/user', { foo: 'bar' })
+ .then(handleResponse)
+ .catch(handleError);
+
+// Typed methods
+interface User {
+ id: number;
+ name: string;
+}
+
+// with default AxiosResponse<T> result
+
+const handleUserResponse = (response: AxiosResponse<User>) => {
+ console.log(response.data.id);
+ console.log(response.data.name);
+ console.log(response.status);
+ console.log(response.statusText);
+ console.log(response.headers);
+ console.log(response.config);
+};
+
+axios.get<User>('/user?id=12345')
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.get<User>('/user', { params: { id: 12345 } })
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.head<User>('/user')
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.options<User>('/user')
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.delete<User>('/user')
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.post<User>('/user', { foo: 'bar' })
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.post<User>('/user', { foo: 'bar' }, { headers: { 'X-FOO': 'bar' } })
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.put<User>('/user', { foo: 'bar' })
+ .then(handleUserResponse)
+ .catch(handleError);
+
+axios.patch<User>('/user', { foo: 'bar' })
+ .then(handleUserResponse)
+ .catch(handleError);
+
+// (Typed methods) with custom response type
+
+const handleStringResponse = (response: string) => {
+ console.log(response)
+}
+
+axios.get<User, string>('/user?id=12345')
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.get<User, string>('/user', { params: { id: 12345 } })
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.head<User, string>('/user')
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.options<User, string>('/user')
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.delete<User, string>('/user')
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.post<User, string>('/user', { foo: 'bar' })
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.post<User, string>('/user', { foo: 'bar' }, { headers: { 'X-FOO': 'bar' } })
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.put<User, string>('/user', { foo: 'bar' })
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.patch<User, string>('/user', { foo: 'bar' })
+ .then(handleStringResponse)
+ .catch(handleError);
+
+axios.request<User, string>({
+ method: 'get',
+ url: '/user?id=12345'
+})
+ .then(handleStringResponse)
+ .catch(handleError);
+
+// Instances
+
+const instance1: AxiosInstance = axios.create();
+const instance2: AxiosInstance = axios.create(config);
+
+instance1(config)
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.request(config)
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.get('/user?id=12345')
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.options('/user')
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.get('/user', { params: { id: 12345 } })
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.post('/user', { foo: 'bar' })
+ .then(handleResponse)
+ .catch(handleError);
+
+instance1.post('/user', { foo: 'bar' }, { headers: { 'X-FOO': 'bar' } })
+ .then(handleResponse)
+ .catch(handleError);
+
+// Defaults
+
+axios.defaults.baseURL = 'https://api.example.com/';
+axios.defaults.headers.common['Authorization'] = 'token';
+axios.defaults.headers.post['X-FOO'] = 'bar';
+axios.defaults.timeout = 2500;
+
+instance1.defaults.baseURL = 'https://api.example.com/';
+instance1.defaults.headers.common['Authorization'] = 'token';
+instance1.defaults.headers.post['X-FOO'] = 'bar';
+instance1.defaults.timeout = 2500;
+
+// Interceptors
+
+const requestInterceptorId: number = axios.interceptors.request.use(
+ (config: AxiosRequestConfig) => config,
+ (error: any) => Promise.reject(error)
+);
+
+axios.interceptors.request.eject(requestInterceptorId);
+
+axios.interceptors.request.use(
+ (config: AxiosRequestConfig) => Promise.resolve(config),
+ (error: any) => Promise.reject(error)
+);
+
+axios.interceptors.request.use((config: AxiosRequestConfig) => config);
+axios.interceptors.request.use((config: AxiosRequestConfig) => Promise.resolve(config));
+
+const responseInterceptorId: number = axios.interceptors.response.use(
+ (response: AxiosResponse) => response,
+ (error: any) => Promise.reject(error)
+);
+
+axios.interceptors.response.eject(responseInterceptorId);
+
+axios.interceptors.response.use(
+ (response: AxiosResponse) => Promise.resolve(response),
+ (error: any) => Promise.reject(error)
+);
+
+axios.interceptors.response.use((response: AxiosResponse) => response);
+axios.interceptors.response.use((response: AxiosResponse) => Promise.resolve(response));
+
+// Adapters
+
+const adapter: AxiosAdapter = (config: AxiosRequestConfig) => {
+ const response: AxiosResponse = {
+ data: { foo: 'bar' },
+ status: 200,
+ statusText: 'OK',
+ headers: { 'X-FOO': 'bar' },
+ config
+ };
+ return Promise.resolve(response);
+};
+
+axios.defaults.adapter = adapter;
+
+// axios.all
+
+const promises = [
+ Promise.resolve(1),
+ Promise.resolve(2)
+];
+
+const promise: Promise<number[]> = axios.all(promises);
+
+// axios.spread
+
+const fn1 = (a: number, b: number, c: number) => `${a}-${b}-${c}`;
+const fn2: (arr: number[]) => string = axios.spread(fn1);
+
+// Promises
+
+axios.get('/user')
+ .then((response: AxiosResponse) => 'foo')
+ .then((value: string) => {});
+
+axios.get('/user')
+ .then((response: AxiosResponse) => Promise.resolve('foo'))
+ .then((value: string) => {});
+
+axios.get('/user')
+ .then((response: AxiosResponse) => 'foo', (error: any) => 'bar')
+ .then((value: string) => {});
+
+axios.get('/user')
+ .then((response: AxiosResponse) => 'foo', (error: any) => 123)
+ .then((value: string | number) => {});
+
+axios.get('/user')
+ .catch((error: any) => 'foo')
+ .then((value: string) => {});
+
+axios.get('/user')
+ .catch((error: any) => Promise.resolve('foo'))
+ .then((value: string) => {});
+
+// Cancellation
+
+const source: CancelTokenSource = axios.CancelToken.source();
+
+axios.get('/user', {
+ cancelToken: source.token
+}).catch((thrown: AxiosError | Cancel) => {
+ if (axios.isCancel(thrown)) {
+ const cancel: Cancel = thrown;
+ console.log(cancel.message);
+ }
+});
+
+source.cancel('Operation has been canceled.');
+
+// AxiosError
+
+axios.get('/user')
+ .catch((error) => {
+ if (axios.isAxiosError(error)) {
+ const axiosError: AxiosError = error;
+ }
+ });
diff --git a/test/unit/adapters/cert.pem b/test/unit/adapters/cert.pem
new file mode 100644
index 0000000..42dcc29
--- /dev/null
+++ b/test/unit/adapters/cert.pem
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICpDCCAYwCCQDbqELLwgbPdDANBgkqhkiG9w0BAQUFADAUMRIwEAYDVQQDDAls
+b2NhbGhvc3QwHhcNMjAwNjI2MjIxMTQ3WhcNNDcxMTExMjIxMTQ3WjAUMRIwEAYD
+VQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD6
+Ogt99/dZ0UgbCuVV1RZ9n28Ov3DzrJCkjperQoXomIq3Fr4RUI1a2rwe3mtl3UzE
+1IVZVvWPGdEsEQHwXfAsP/jFGTwI3HDyOhcqzFQSKsjvqJWYkOOb+2r3SBrFlRZW
+09k/3lC+hx2XtuuG68u4Xgn3AlUvm2vplgCN7eiYcGeNwVuf2eHdOqTRTqiYCZLi
+T8GtdYMDXOrwsGZs/jUKd9U0ar/lqwMhmw07yzlVDM2MWM2tyq/asQ7Sf7vuoMFu
+oAtDJ3E+bK1k/7SNhdyP4RonhyUCkWG+mzoKDS1qgXroTiQSDUksAvOCTcj8BNIT
+ee+Lcn9FaTKNJiKiU9q/AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAFi5ZpaUj+mU
+dsgOka+j2/njgNXux3cOjhm7z/N7LeTuDENAOrYa5b+j5JX/YM7RKHrkbXHsQbfs
+GB3ufH6QhSiCd/AdsXp/TbCE/8gdq8ykkjwVP1bvBle9oPH7x1aO/WP/odsepYUv
+o9aOZW4iNQVmwamU62ezglf3QD7HPeE4LnZueaFtuzRoC+aWT9v0MIeUPJLe3WDQ
+FEySwUuthMDJEv92/TeK0YOiunmseCu2mvdiDj6E3C9xa5q2DWgl+msu7+bPgvYO
+GuWaoNeQQGk7ebBO3Hk3IyaGx6Cbd8ty+YaZW7dUT+m7KCs1VkxdcDMjZJVWiJy4
+4HcEcKboG4Y=
+-----END CERTIFICATE-----
diff --git a/test/unit/adapters/http.js b/test/unit/adapters/http.js
new file mode 100644
index 0000000..497eb28
--- /dev/null
+++ b/test/unit/adapters/http.js
@@ -0,0 +1,883 @@
+var axios = require('../../../index');
+var http = require('http');
+var https = require('https');
+var net = require('net');
+var url = require('url');
+var zlib = require('zlib');
+var assert = require('assert');
+var fs = require('fs');
+var path = require('path');
+var server, proxy;
+
+describe('supports http with nodejs', function () {
+
+ afterEach(function () {
+ if (server) {
+ server.close();
+ server = null;
+ }
+ if (proxy) {
+ proxy.close()
+ proxy = null;
+ }
+ if (process.env.http_proxy) {
+ delete process.env.http_proxy;
+ }
+ if (process.env.no_proxy) {
+ delete process.env.no_proxy;
+ }
+ });
+
+ it('should respect the timeout property', function (done) {
+
+ server = http.createServer(function (req, res) {
+ setTimeout(function () {
+ res.end();
+ }, 1000);
+ }).listen(4444, function () {
+ var success = false, failure = false;
+ var error;
+
+ axios.get('http://localhost:4444/', {
+ timeout: 250
+ }).then(function (res) {
+ success = true;
+ }).catch(function (err) {
+ error = err;
+ failure = true;
+ });
+
+ setTimeout(function () {
+ assert.equal(success, false, 'request should not succeed');
+ assert.equal(failure, true, 'request should fail');
+ assert.equal(error.code, 'ECONNABORTED');
+ assert.equal(error.message, 'timeout of 250ms exceeded');
+ done();
+ }, 300);
+ });
+ });
+
+ it('should allow passing JSON', function (done) {
+ var data = {
+ firstName: 'Fred',
+ lastName: 'Flintstone',
+ emailAddr: 'fred@example.com'
+ };
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'application/json;charset=utf-8');
+ res.end(JSON.stringify(data));
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.deepEqual(res.data, data);
+ done();
+ });
+ });
+ });
+
+ it('should allow passing JSON with BOM', function (done) {
+ var data = {
+ firstName: 'Fred',
+ lastName: 'Flintstone',
+ emailAddr: 'fred@example.com'
+ };
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'application/json;charset=utf-8');
+ var bomBuffer = Buffer.from([0xEF, 0xBB, 0xBF])
+ var jsonBuffer = Buffer.from(JSON.stringify(data));
+ res.end(Buffer.concat([bomBuffer, jsonBuffer]));
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.deepEqual(res.data, data);
+ done();
+ });
+ });
+ });
+
+ it('should redirect', function (done) {
+ var str = 'test response';
+
+ server = http.createServer(function (req, res) {
+ var parsed = url.parse(req.url);
+
+ if (parsed.pathname === '/one') {
+ res.setHeader('Location', '/two');
+ res.statusCode = 302;
+ res.end();
+ } else {
+ res.end(str);
+ }
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/one').then(function (res) {
+ assert.equal(res.data, str);
+ assert.equal(res.request.path, '/two');
+ done();
+ });
+ });
+ });
+
+ it('should not redirect', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Location', '/foo');
+ res.statusCode = 302;
+ res.end();
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/', {
+ maxRedirects: 0,
+ validateStatus: function () {
+ return true;
+ }
+ }).then(function (res) {
+ assert.equal(res.status, 302);
+ assert.equal(res.headers['location'], '/foo');
+ done();
+ });
+ });
+ });
+
+ it('should support max redirects', function (done) {
+ var i = 1;
+ server = http.createServer(function (req, res) {
+ res.setHeader('Location', '/' + i);
+ res.statusCode = 302;
+ res.end();
+ i++;
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/', {
+ maxRedirects: 3
+ }).catch(function (error) {
+ done();
+ });
+ });
+ });
+
+ it('should preserve the HTTP verb on redirect', function (done) {
+ server = http.createServer(function (req, res) {
+ if (req.method.toLowerCase() !== "head") {
+ res.statusCode = 400;
+ res.end();
+ return;
+ }
+
+ var parsed = url.parse(req.url);
+ if (parsed.pathname === '/one') {
+ res.setHeader('Location', '/two');
+ res.statusCode = 302;
+ res.end();
+ } else {
+ res.end();
+ }
+ }).listen(4444, function () {
+ axios.head('http://localhost:4444/one').then(function (res) {
+ assert.equal(res.status, 200);
+ done();
+ }).catch(function (err) {
+ done(err);
+ });
+ });
+ });
+
+ it('should support transparent gunzip', function (done) {
+ var data = {
+ firstName: 'Fred',
+ lastName: 'Flintstone',
+ emailAddr: 'fred@example.com'
+ };
+
+ zlib.gzip(JSON.stringify(data), function (err, zipped) {
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'application/json;charset=utf-8');
+ res.setHeader('Content-Encoding', 'gzip');
+ res.end(zipped);
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.deepEqual(res.data, data);
+ done();
+ });
+ });
+
+ });
+ });
+
+ it('should support gunzip error handling', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'application/json;charset=utf-8');
+ res.setHeader('Content-Encoding', 'gzip');
+ res.end('invalid response');
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/').catch(function (error) {
+ done();
+ });
+ });
+ });
+
+ it('should support disabling automatic decompression of response data', function(done) {
+ var data = 'Test data';
+
+ zlib.gzip(data, function(err, zipped) {
+ server = http.createServer(function(req, res) {
+ res.setHeader('Content-Type', 'text/html;charset=utf-8');
+ res.setHeader('Content-Encoding', 'gzip');
+ res.end(zipped);
+ }).listen(4444, function() {
+ axios.get('http://localhost:4444/', {
+ decompress: false,
+ responseType: 'arraybuffer'
+
+ }).then(function(res) {
+ assert.equal(res.data.toString('base64'), zipped.toString('base64'));
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support UTF8', function (done) {
+ var str = Array(100000).join('ж');
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end(str);
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.equal(res.data, str);
+ done();
+ });
+ });
+ });
+
+ it('should support basic auth', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end(req.headers.authorization);
+ }).listen(4444, function () {
+ var user = 'foo';
+ var headers = { Authorization: 'Bearer 1234' };
+ axios.get('http://' + user + '@localhost:4444/', { headers: headers }).then(function (res) {
+ var base64 = Buffer.from(user + ':', 'utf8').toString('base64');
+ assert.equal(res.data, 'Basic ' + base64);
+ done();
+ });
+ });
+ });
+
+ it('should support basic auth with a header', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end(req.headers.authorization);
+ }).listen(4444, function () {
+ var auth = { username: 'foo', password: 'bar' };
+ var headers = { Authorization: 'Bearer 1234' };
+ axios.get('http://localhost:4444/', { auth: auth, headers: headers }).then(function (res) {
+ var base64 = Buffer.from('foo:bar', 'utf8').toString('base64');
+ assert.equal(res.data, 'Basic ' + base64);
+ done();
+ });
+ });
+ });
+
+ it('should support max content length', function (done) {
+ var str = Array(100000).join('ж');
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end(str);
+ }).listen(4444, function () {
+ var success = false, failure = false, error;
+
+ axios.get('http://localhost:4444/', {
+ maxContentLength: 2000
+ }).then(function (res) {
+ success = true;
+ }).catch(function (err) {
+ error = err;
+ failure = true;
+ });
+
+ setTimeout(function () {
+ assert.equal(success, false, 'request should not succeed');
+ assert.equal(failure, true, 'request should fail');
+ assert.equal(error.message, 'maxContentLength size of 2000 exceeded');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should support max content length for redirected', function (done) {
+ var str = Array(100000).join('ж');
+
+ server = http.createServer(function (req, res) {
+ var parsed = url.parse(req.url);
+
+ if (parsed.pathname === '/two') {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end(str);
+ } else {
+ res.setHeader('Location', '/two');
+ res.statusCode = 302;
+ res.end();
+ }
+ }).listen(4444, function () {
+ var success = false, failure = false, error;
+
+ axios.get('http://localhost:4444/one', {
+ maxContentLength: 2000
+ }).then(function (res) {
+ success = true;
+ }).catch(function (err) {
+ error = err;
+ failure = true;
+ });
+
+ setTimeout(function () {
+ assert.equal(success, false, 'request should not succeed');
+ assert.equal(failure, true, 'request should fail');
+ assert.equal(error.message, 'maxContentLength size of 2000 exceeded');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should support max body length', function (done) {
+ var data = Array(100000).join('ж');
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end();
+ }).listen(4444, function () {
+ var success = false, failure = false, error;
+
+ axios.post('http://localhost:4444/', {
+ data: data
+ }, {
+ maxBodyLength: 2000
+ }).then(function (res) {
+ success = true;
+ }).catch(function (err) {
+ error = err;
+ failure = true;
+ });
+
+
+ setTimeout(function () {
+ assert.equal(success, false, 'request should not succeed');
+ assert.equal(failure, true, 'request should fail');
+ assert.equal(error.code, 'ERR_FR_MAX_BODY_LENGTH_EXCEEDED');
+ assert.equal(error.message, 'Request body larger than maxBodyLength limit');
+ done();
+ }, 100);
+ });
+ });
+
+ it('should support sockets', function (done) {
+ // Different sockets for win32 vs darwin/linux
+ var socketName = './test.sock';
+
+ if (process.platform === 'win32') {
+ socketName = '\\\\.\\pipe\\libuv-test';
+ }
+
+ server = net.createServer(function (socket) {
+ socket.on('data', function () {
+ socket.end('HTTP/1.1 200 OK\r\n\r\n');
+ });
+ }).listen(socketName, function () {
+ axios({
+ socketPath: socketName,
+ url: '/'
+ })
+ .then(function (resp) {
+ assert.equal(resp.status, 200);
+ assert.equal(resp.statusText, 'OK');
+ done();
+ })
+ .catch(function (error) {
+ assert.ifError(error);
+ done();
+ });
+ });
+ });
+
+ it('should support streams', function (done) {
+ server = http.createServer(function (req, res) {
+ req.pipe(res);
+ }).listen(4444, function () {
+ axios.post('http://localhost:4444/',
+ fs.createReadStream(__filename), {
+ responseType: 'stream'
+ }).then(function (res) {
+ var stream = res.data;
+ var string = '';
+ stream.on('data', function (chunk) {
+ string += chunk.toString('utf8');
+ });
+ stream.on('end', function () {
+ assert.equal(string, fs.readFileSync(__filename, 'utf8'));
+ done();
+ });
+ });
+ });
+ });
+
+ it('should pass errors for a failed stream', function (done) {
+ var notExitPath = path.join(__dirname, 'does_not_exist');
+
+ server = http.createServer(function (req, res) {
+ req.pipe(res);
+ }).listen(4444, function () {
+ axios.post('http://localhost:4444/',
+ fs.createReadStream(notExitPath)
+ ).then(function (res) {
+ assert.fail();
+ }).catch(function (err) {
+ assert.equal(err.message, `ENOENT: no such file or directory, open \'${notExitPath}\'`);
+ done();
+ });
+ });
+ });
+
+ it('should support buffers', function (done) {
+ var buf = Buffer.alloc(1024, 'x'); // Unsafe buffer < Buffer.poolSize (8192 bytes)
+ server = http.createServer(function (req, res) {
+ assert.equal(req.headers['content-length'], buf.length.toString());
+ req.pipe(res);
+ }).listen(4444, function () {
+ axios.post('http://localhost:4444/',
+ buf, {
+ responseType: 'stream'
+ }).then(function (res) {
+ var stream = res.data;
+ var string = '';
+ stream.on('data', function (chunk) {
+ string += chunk.toString('utf8');
+ });
+ stream.on('end', function () {
+ assert.equal(string, buf.toString());
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support HTTP proxies', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('12345');
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '6789');
+ });
+ });
+
+ }).listen(4000, function () {
+ axios.get('http://localhost:4444/', {
+ proxy: {
+ host: 'localhost',
+ port: 4000
+ }
+ }).then(function (res) {
+ assert.equal(res.data, '123456789', 'should pass through proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support HTTPS proxies', function (done) {
+ var options = {
+ key: fs.readFileSync(path.join(__dirname, 'key.pem')),
+ cert: fs.readFileSync(path.join(__dirname, 'cert.pem'))
+ };
+
+ server = https.createServer(options, function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('12345');
+ }).listen(4444, function () {
+ proxy = https.createServer(options, function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path,
+ protocol: parsed.protocol,
+ rejectUnauthorized: false
+ };
+
+ https.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '6789');
+ });
+ });
+ }).listen(4000, function () {
+ axios.get('https://localhost:4444/', {
+ proxy: {
+ host: 'localhost',
+ port: 4000,
+ protocol: 'https'
+ },
+ httpsAgent: new https.Agent({
+ rejectUnauthorized: false
+ })
+ }).then(function (res) {
+ assert.equal(res.data, '123456789', 'should pass through proxy');
+ done();
+ }).catch(function (err) {
+ assert.fail(err);
+ done()
+ });
+ });
+ });
+ });
+
+ it('should not pass through disabled proxy', function (done) {
+ // set the env variable
+ process.env.http_proxy = 'http://does-not-exists.example.com:4242/';
+
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('123456789');
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/', {
+ proxy: false
+ }).then(function (res) {
+ assert.equal(res.data, '123456789', 'should not pass through proxy');
+ done();
+ });
+ });
+ });
+
+ it('should support proxy set via env var', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('4567');
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '1234');
+ });
+ });
+
+ }).listen(4000, function () {
+ // set the env variable
+ process.env.http_proxy = 'http://localhost:4000/';
+
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.equal(res.data, '45671234', 'should use proxy set by process.env.http_proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support HTTPS proxy set via env var', function (done) {
+ var options = {
+ key: fs.readFileSync(path.join(__dirname, 'key.pem')),
+ cert: fs.readFileSync(path.join(__dirname, 'cert.pem'))
+ };
+
+ server = https.createServer(options, function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('12345');
+ }).listen(4444, function () {
+ proxy = https.createServer(options, function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path,
+ protocol: parsed.protocol,
+ rejectUnauthorized: false
+ };
+
+ https.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '6789');
+ });
+ });
+ }).listen(4000, function () {
+ process.env.https_proxy = 'https://localhost:4000/';
+
+ axios.get('https://localhost:4444/', {
+ httpsAgent: new https.Agent({
+ rejectUnauthorized: false
+ })
+ }).then(function (res) {
+ assert.equal(res.data, '123456789', 'should pass through proxy');
+ done();
+ }).catch(function (err) {
+ assert.fail(err);
+ done()
+ }).finally(function () {
+ process.env.https_proxy = ''
+ });
+ });
+ });
+ });
+
+ it('should not use proxy for domains in no_proxy', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('4567');
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '1234');
+ });
+ });
+
+ }).listen(4000, function () {
+ // set the env variable
+ process.env.http_proxy = 'http://localhost:4000/';
+ process.env.no_proxy = 'foo.com, localhost,bar.net , , quix.co';
+
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.equal(res.data, '4567', 'should not use proxy for domains in no_proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should use proxy for domains not in no_proxy', function (done) {
+ server = http.createServer(function (req, res) {
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ res.end('4567');
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(body + '1234');
+ });
+ });
+
+ }).listen(4000, function () {
+ // set the env variable
+ process.env.http_proxy = 'http://localhost:4000/';
+ process.env.no_proxy = 'foo.com, ,bar.net , quix.co';
+
+ axios.get('http://localhost:4444/').then(function (res) {
+ assert.equal(res.data, '45671234', 'should use proxy for domains not in no_proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support HTTP proxy auth', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end();
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+ var proxyAuth = request.headers['proxy-authorization'];
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(proxyAuth);
+ });
+ });
+
+ }).listen(4000, function () {
+ axios.get('http://localhost:4444/', {
+ proxy: {
+ host: 'localhost',
+ port: 4000,
+ auth: {
+ username: 'user',
+ password: 'pass'
+ }
+ }
+ }).then(function (res) {
+ var base64 = Buffer.from('user:pass', 'utf8').toString('base64');
+ assert.equal(res.data, 'Basic ' + base64, 'should authenticate to the proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support proxy auth from env', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end();
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+ var proxyAuth = request.headers['proxy-authorization'];
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(proxyAuth);
+ });
+ });
+
+ }).listen(4000, function () {
+ process.env.http_proxy = 'http://user:pass@localhost:4000/';
+
+ axios.get('http://localhost:4444/').then(function (res) {
+ var base64 = Buffer.from('user:pass', 'utf8').toString('base64');
+ assert.equal(res.data, 'Basic ' + base64, 'should authenticate to the proxy set by process.env.http_proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support proxy auth with header', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end();
+ }).listen(4444, function () {
+ proxy = http.createServer(function (request, response) {
+ var parsed = url.parse(request.url);
+ var opts = {
+ host: parsed.hostname,
+ port: parsed.port,
+ path: parsed.path
+ };
+ var proxyAuth = request.headers['proxy-authorization'];
+
+ http.get(opts, function (res) {
+ var body = '';
+ res.on('data', function (data) {
+ body += data;
+ });
+ res.on('end', function () {
+ response.setHeader('Content-Type', 'text/html; charset=UTF-8');
+ response.end(proxyAuth);
+ });
+ });
+
+ }).listen(4000, function () {
+ axios.get('http://localhost:4444/', {
+ proxy: {
+ host: 'localhost',
+ port: 4000,
+ auth: {
+ username: 'user',
+ password: 'pass'
+ }
+ },
+ headers: {
+ 'Proxy-Authorization': 'Basic abc123'
+ }
+ }).then(function (res) {
+ var base64 = Buffer.from('user:pass', 'utf8').toString('base64');
+ assert.equal(res.data, 'Basic ' + base64, 'should authenticate to the proxy');
+ done();
+ });
+ });
+ });
+ });
+
+ it('should support cancel', function (done) {
+ var source = axios.CancelToken.source();
+ server = http.createServer(function (req, res) {
+ // call cancel() when the request has been sent, but a response has not been received
+ source.cancel('Operation has been canceled.');
+ }).listen(4444, function () {
+ axios.get('http://localhost:4444/', {
+ cancelToken: source.token
+ }).catch(function (thrown) {
+ assert.ok(thrown instanceof axios.Cancel, 'Promise must be rejected with a Cancel obejct');
+ assert.equal(thrown.message, 'Operation has been canceled.');
+ done();
+ });
+ });
+ });
+
+ it('should combine baseURL and url', function (done) {
+ server = http.createServer(function (req, res) {
+ res.end();
+ }).listen(4444, function () {
+ axios.get('/foo', {
+ baseURL: 'http://localhost:4444/',
+ }).then(function (res) {
+ assert.equal(res.config.baseURL, 'http://localhost:4444/');
+ assert.equal(res.config.url, '/foo');
+ done();
+ });
+ });
+ });
+});
+
diff --git a/test/unit/adapters/key.pem b/test/unit/adapters/key.pem
new file mode 100644
index 0000000..9ce05bf
--- /dev/null
+++ b/test/unit/adapters/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEA+joLfff3WdFIGwrlVdUWfZ9vDr9w86yQpI6Xq0KF6JiKtxa+
+EVCNWtq8Ht5rZd1MxNSFWVb1jxnRLBEB8F3wLD/4xRk8CNxw8joXKsxUEirI76iV
+mJDjm/tq90gaxZUWVtPZP95Qvocdl7brhuvLuF4J9wJVL5tr6ZYAje3omHBnjcFb
+n9nh3Tqk0U6omAmS4k/BrXWDA1zq8LBmbP41CnfVNGq/5asDIZsNO8s5VQzNjFjN
+rcqv2rEO0n+77qDBbqALQydxPmytZP+0jYXcj+EaJ4clApFhvps6Cg0taoF66E4k
+Eg1JLALzgk3I/ATSE3nvi3J/RWkyjSYiolPavwIDAQABAoIBAEbMi5ndwjfAlkVI
+hPEPNKjgpnymwB/CEL7utY04akkQeBcrsSWXBBfT0exuBDczMVhzxTMs/pe5t0xf
+l4vaGG18wDeMV0cukCqJMyrh21u0jVv5+DHNtQjaTz6eQSzsbQCuOkbu8SuncUEO
++X8YUnDc8rbYCyBIOnVCAvAlg201uW0G5G9NEwJOu6cAKMKkogdHqv+FRX96C5hm
+gtbGEzpGV2vVClgMwMcX49ucluZvqLvit/yehNVd0VOtW/kuLup4R6q0abHRapDd
+95rJAhPvar4mzP+UgJrGQ9hozqhizDthBjnsmGeMBUiBCkay7OXIZpvLoCpQkti1
+WIWuikkCgYEA/oZqq71RT1nPuI7rlcjx3AeWe2EUQtKhQMJBiPx5eLLP6gII8+v2
+pD1qlmJM2eyIK0lzuskLIulTAA5Z+ejORDbvmn/DdT0CSvdrUFrcvnrRQnt2M5M2
+9VDRp6nvPE0H4kRZJrtITyLn0dv5ABf2L32i4dPCMePjKjSUygJSHrsCgYEA+61A
+cIqch/lrQTk8hG7Y6p0EJzSInFVaKuZoMYpLhlDQcVvSDIQbGgRAN6BKTdxeQ+tK
+hSxBSm2mze11aHig8GBGgdBFLaJOZRo6G+2fl+s1t1FCHfsaFhHwheZJONHMpKKd
+Qm/7L/V35QV9YG0lPZ01TM6d5lXuKsmUNvBJTc0CgYASYajAgGqn3WeX/5JZ/eoh
+ptaiUG+DJ+0HXUAYYYtwQRGs57q3yvnEAL963tyH/IIVBjf6bFyGh+07ms26s6p5
+2LHTKZj3FZHd0iKI6hb5FquYLoxpyx7z9oM9pZMmerWwDJmXp3zgYjf1uvovnItm
+AJ/LyVxD+B5GxQdd028U0wKBgG4OllZglxDzJk7wa6FyI9N89Fr8oxzSSkrmVPwN
+APfskSpxP8qPXpai8z4gDz47NtG2q/DOqIKWrtHwnF4iGibjwxFzdTz+dA/MR0r9
+P8QcbHIMy7/2lbK/B5JWYQDC5h28qs5pz8tqKZLyMqCfOiDWhX9f/zbBrxPw8KqR
+q0ylAoGAL/0kemA/Tmxpwmp0S0oCqnA4gbCgS7qnApxB09xTewc/tuvraXc3Mzea
+EvqDXLXK0R7O4E3vo0Mr23SodRVlFPevsmUUJLPJMJcxdfnSJgX+qE/UC8Ux+UMi
+eYufYRDYSslfL2rt9D7abnnbqSfsHymJKukWpElIgJTklQUru4k=
+-----END RSA PRIVATE KEY-----
diff --git a/test/unit/regression/SNYK-JS-AXIOS-1038255.js b/test/unit/regression/SNYK-JS-AXIOS-1038255.js
new file mode 100644
index 0000000..52c7498
--- /dev/null
+++ b/test/unit/regression/SNYK-JS-AXIOS-1038255.js
@@ -0,0 +1,61 @@
+// https://snyk.io/vuln/SNYK-JS-AXIOS-1038255
+// https://github.com/axios/axios/issues/3407
+// https://github.com/axios/axios/issues/3369
+
+const axios = require('../../../index');
+const http = require('http');
+const assert = require('assert');
+
+const PROXY_PORT = 4777;
+const EVIL_PORT = 4666;
+
+
+describe('Server-Side Request Forgery (SSRF)', () => {
+ let fail = false;
+ let proxy;
+ let server;
+ let location;
+ beforeEach(() => {
+ server = http.createServer(function (req, res) {
+ fail = true;
+ res.end('rm -rf /');
+ }).listen(EVIL_PORT);
+ proxy = http.createServer(function (req, res) {
+ if (req.url === 'http://localhost:' + EVIL_PORT + '/') {
+ return res.end(JSON.stringify({
+ msg: 'Protected',
+ headers: req.headers,
+ }));
+ }
+ res.writeHead(302, { location })
+ res.end()
+ }).listen(PROXY_PORT);
+ });
+ afterEach(() => {
+ server.close();
+ proxy.close();
+ });
+ it('obeys proxy settings when following redirects', async () => {
+ location = 'http://localhost:' + EVIL_PORT;
+ let response = await axios({
+ method: "get",
+ url: "http://www.google.com/",
+ proxy: {
+ host: "localhost",
+ port: PROXY_PORT,
+ auth: {
+ username: 'sam',
+ password: 'password',
+ }
+ },
+ });
+
+ assert.strictEqual(fail, false);
+ assert.strictEqual(response.data.msg, 'Protected');
+ assert.strictEqual(response.data.headers.host, 'localhost:' + EVIL_PORT);
+ assert.strictEqual(response.data.headers['proxy-authorization'], 'Basic ' + Buffer.from('sam:password').toString('base64'));
+
+ return response;
+
+ });
+}); \ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..1a3e5b5
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,44 @@
+var webpack = require('webpack');
+var config = {};
+
+function generateConfig(name) {
+ var uglify = name.indexOf('min') > -1;
+ var config = {
+ entry: './index.js',
+ output: {
+ path: 'dist/',
+ filename: name + '.js',
+ sourceMapFilename: name + '.map',
+ library: 'axios',
+ libraryTarget: 'umd'
+ },
+ node: {
+ process: false
+ },
+ devtool: 'source-map'
+ };
+
+ config.plugins = [
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
+ })
+ ];
+
+ if (uglify) {
+ config.plugins.push(
+ new webpack.optimize.UglifyJsPlugin({
+ compressor: {
+ warnings: false
+ }
+ })
+ );
+ }
+
+ return config;
+}
+
+['axios', 'axios.min'].forEach(function (key) {
+ config[key] = generateConfig(key);
+});
+
+module.exports = config;