From e52cd3ac6439237414a17ab6f37d8a50df6d989b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szyma=C5=84ski?= Date: Thu, 16 Sep 2021 21:08:40 +0200 Subject: [PATCH 1/3] Add globalObject: 'this' to webpack config (#3176) This should solve the issue of undefined `this` when importing from an ES6 module. I've put steps to reproduce in [this comment](https://github.com/axios/axios/issues/1861#issuecomment-669832435). Co-authored-by: Jay --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 9dba880a72..69e0323fdb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,7 +11,8 @@ function generateConfig(name) { filename: name + '.js', sourceMapFilename: name + '.map', library: 'axios', - libraryTarget: 'umd' + libraryTarget: 'umd', + globalObject: 'this' }, node: { process: false From 96956e30ba2768b754d53125af832c9ccf66a9cd Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Thu, 16 Sep 2021 12:16:43 -0700 Subject: [PATCH 2/3] Improve timeout error when timeout is browser default (#3209) I seems like the browser imposes a default timeout despite the documented default timeout being "never". When this timeout occurs, axios confusingly reports an error "timeout of 0ms exceeded". This change the message to avoid the confusing "0ms" part. Co-authored-by: Jay --- lib/adapters/xhr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index a386dd24aa..48d2e8eb4c 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -104,7 +104,7 @@ module.exports = function xhrAdapter(config) { // Handle timeout request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; if (config.timeoutErrorMessage) { timeoutErrorMessage = config.timeoutErrorMessage; } From 7d6bddba2d8de29c263feaef4c40daa50cb4b176 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 17 Sep 2021 08:41:32 +0200 Subject: [PATCH 3/3] Fix node version on CI (#4069) Co-authored-by: Jay --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be8d079534..739ec2ef63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,6 @@ jobs: - name: Setup node uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node }} + node-version: ${{ matrix.node-version }} - run: npm install - run: npm test