Skip to content

Commit ee90dfc

Browse files
authored
fix: issues with version 1.13.3 (axios#7352)
1 parent af4f6d9 commit ee90dfc

File tree

5 files changed

+27
-107
lines changed

5 files changed

+27
-107
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,3 @@ jobs:
3030
run: npm publish --provenance --access public
3131
env:
3232
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33-
- name: Create release tag on GitHub
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
TAG: ${{ github.ref_name }}
37-
run: |
38-
gh release create "$TAG" \
39-
--repo="$GITHUB_REPOSITORY" \
40-
--title="${GITHUB_REPOSITORY#*/} ${TAG#v}" \
41-
--generate-notes

.github/workflows/release-branch.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,27 @@ jobs:
3535
cache: npm
3636
- name: Install dependencies
3737
run: npm ci
38-
- name: Bump version
39-
id: bump_version
40-
uses: phips28/gh-action-bump-version@v9
38+
- name: Configure git identity
39+
run: |
40+
git config --global user.name "github-actions[bot]"
41+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
42+
- name: Bump version with NPM version
4143
env:
4244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
version-type: ${{ github.event.inputs.type }}
45-
default: ${{ github.event.inputs.beta == true && 'prerelease' || 'patch' }}
46-
commit-message: "chore(release): prepare release {{version}}"
47-
tag-prefix: "v"
48-
skip-tag: true
49-
skip-push: true
45+
id: bump-version
46+
run: |
47+
TYPE=${{ github.event.inputs.type }}
48+
BETA=${{ github.event.inputs.beta }}
49+
if [ "$TYPE" = "auto" ]; then
50+
npm version $(npm version | grep -Eo 'patch|minor|major' | head -1)
51+
else
52+
if [ "$BETA" = "true" ]; then
53+
npm version $TYPE --preid=beta
54+
else
55+
npm version $TYPE
56+
fi
57+
fi
58+
echo "::set-output name=newTag::$(node -p "require('./package.json').version")"
5059
- name: Build project
5160
run: npm run build
5261
- name: Run unit tests
@@ -56,14 +65,12 @@ jobs:
5665
- name: Run browser tests
5766
run: npm run test:browser
5867
- name: Create Pull Request
59-
uses: peter-evans/create-pull-request@v7
68+
uses: peter-evans/create-pull-request@v8
6069
with:
61-
token: ${{ secrets.GITHUB_TOKEN }}
62-
commit-message: "chore(release): prepare release ${{ steps.bump_version.outputs.newTag }}"
63-
branch: "release/${{ steps.bump_version.outputs.newTag }}"
64-
title: "chore(release): prepare release ${{ steps.bump_version.outputs.newTag }}"
65-
body: "This PR prepares the release ${{ steps.bump_version.outputs.newTag }}."
66-
base: main
70+
branch: "release"
71+
commit-message: "chore(release): prepare release ${{ steps.bump-version.outputs.newTag }}"
72+
body: "This PR prepares the release ${{ steps.bump-version.outputs.newTag }}."
73+
title: "chore(release): prepare release ${{ steps.bump-version.outputs.newTag }}"
6774
maintainer-can-modify: true
6875
draft: false
6976
labels: |

.github/workflows/update-sponsor-block.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
echo "$CONTENT"
4747
if: steps.sponsors-requires-update.outputs.changed == 'true'
4848
- name: Create pull request
49-
uses: peter-evans/create-pull-request@v7
49+
uses: peter-evans/create-pull-request@v8
5050
with:
5151
branch: sponsors
5252
delete-branch: true

lib/core/Axios.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,8 @@ class Axios {
159159

160160
promise = Promise.resolve(config);
161161

162-
let prevResult = config;
163162
while (i < len) {
164-
promise = promise
165-
.then(chain[i++])
166-
.then(result => { prevResult = result !== undefined ? result : prevResult })
167-
.catch(chain[i++])
168-
.then(() => prevResult);
163+
promise = promise.then(chain[i++], chain[i++]);
169164
}
170165

171166
return promise;
@@ -196,7 +191,7 @@ class Axios {
196191
len = responseInterceptorChain.length;
197192

198193
while (i < len) {
199-
promise = promise.then(responseInterceptorChain[i++]).catch(responseInterceptorChain[i++]);
194+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
200195
}
201196

202197
return promise;

test/specs/interceptors.spec.js

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -599,77 +599,4 @@ describe('interceptors', function () {
599599

600600
expect(instance.interceptors.response.handlers.length).toBe(0);
601601
});
602-
603-
it('should handler the error in the same request interceptors', function (done) {
604-
const rejectedSpy1 = jasmine.createSpy('rejectedSpy1');
605-
const rejectedSpy2 = jasmine.createSpy('rejectedSpy2');
606-
const error1 = new Error('deadly error 1');
607-
const error2 = new Error('deadly error 2');
608-
axios.interceptors.request.use(function () {
609-
throw error1;
610-
}, rejectedSpy1);
611-
612-
axios.interceptors.request.use(function () {
613-
throw error2;
614-
}, rejectedSpy2);
615-
616-
axios('/foo').catch();
617-
618-
getAjaxRequest().then(function () {
619-
expect(rejectedSpy1).toHaveBeenCalledWith(error1);
620-
expect(rejectedSpy2).toHaveBeenCalledWith(error2);
621-
done();
622-
});
623-
});
624-
625-
it('should handle the error in the same response interceptors', function (done) {
626-
const rejectedSpy1 = jasmine.createSpy('rejectedSpy1');
627-
const rejectedSpy2 = jasmine.createSpy('rejectedSpy2');
628-
const error1 = new Error('deadly error 1');
629-
const error2 = new Error('deadly error 2');
630-
axios.interceptors.response.use(function () {
631-
throw error1;
632-
}, rejectedSpy1);
633-
634-
axios.interceptors.response.use(function () {
635-
throw error2;
636-
}, rejectedSpy2);
637-
638-
axios('/foo');
639-
640-
getAjaxRequest().then(function (request) {
641-
request.respondWith({
642-
status: 200,
643-
responseText: 'OK'
644-
});
645-
646-
setTimeout(function () {
647-
expect(rejectedSpy1).toHaveBeenCalledWith(error1);
648-
expect(rejectedSpy2).toHaveBeenCalledWith(error2);
649-
done();
650-
}, 100);
651-
});
652-
});
653-
654-
it('should skip the modification of config in the interceptors throwing error', function (done) {
655-
const rejectedSpy = jasmine.createSpy('rejectedSpy');
656-
const error = new Error('deadly error');
657-
658-
axios.interceptors.request.use(function (config) {
659-
config.headers.test = 'added by interceptor';
660-
return config;
661-
});
662-
663-
axios.interceptors.request.use(function () {
664-
throw error;
665-
}, rejectedSpy);
666-
667-
axios('/foo').catch();
668-
669-
getAjaxRequest().then(function (request) {
670-
expect(rejectedSpy).toHaveBeenCalledWith(error);
671-
expect(request.requestHeaders.test).toBe('added by interceptor');
672-
done();
673-
});
674-
});
675602
});

0 commit comments

Comments
 (0)