Skip to content

Commit

Permalink
Merge pull request #171 from lifeomic/axios-0.28
Browse files Browse the repository at this point in the history
feat: axios 0.28.0
  • Loading branch information
aecorredor authored Feb 26, 2024
2 parents b9003c1 + 80e2aef commit d8bab9b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- 'master'
- 'alpha'

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@aws-sdk/signature-v4": "^3.110.0",
"@aws-sdk/url-parser": "^3.357.0",
"@types/aws-lambda": "^8.10.101",
"axios": "^0.27.2",
"axios": "^0.28.0",
"lodash": "^4.17.21",
"nearley": "2",
"url-parse": "^1.5.10",
Expand Down
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
branches: ['master'],
branches: ['master', { name: 'alpha', prerelease: true }],
plugins: [
['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }],
'@semantic-release/npm',
Expand Down
4 changes: 2 additions & 2 deletions src/alpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ export class Alpha extends Axios {
if (castResp.status === 301 || castResp.status === 302) {
if (maxRedirects === 0) {
const request = castResp.request as InvocationRequest | HandlerRequest;
throw new RequestError('Exceeded maximum number of redirects.', castResp.config, request, response);
throw new RequestError('Exceeded maximum number of redirects.', castResp.config, request, castResp);
}

const redirect = cloneDeep(config);
redirect.maxRedirects = maxRedirects - 1;
redirect.url = resolve(castResp.headers.location, castResp.config.url as string);
redirect.url = resolve(castResp.headers.location as string, castResp.config.url as string);
return this.request(redirect);
}

Expand Down
10 changes: 5 additions & 5 deletions test/lambda-invocation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,19 +482,19 @@ test('A configured timeout does not hinder normal lambda function invocation beh
});

test('A configured timeout does not eat lambda function invocation errors', async () => {
jest.useFakeTimers();
jest.useFakeTimers({ doNotFake: ['performance'] });
jest.spyOn(global, 'setTimeout');
jest.spyOn(global, 'clearTimeout');
delayedLambda(1, new Error('Other error'));
const promise = ctx.alpha.get('/some/path', {
Lambda: FakeLambda,
timeout: 1000,
} as any as AxiosRequestConfig);
});
await expect(promise).rejects.toThrow('Other error');
expect(ctx.abort).not.toBeCalled();
expect(ctx.abort).not.toHaveBeenCalled();

expect(setTimeout).toBeCalledTimes(1);
expect(clearTimeout).toBeCalledTimes(1);
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(clearTimeout).toHaveBeenCalledTimes(1);
});

test('lambda function invocation errors are re-thrown', async () => {
Expand Down
24 changes: 15 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2427,13 +2427,14 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==

axios@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
axios@^0.28.0:
version "0.28.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.0.tgz#801a4d991d0404961bccef46800e1170f8278c89"
integrity sha512-Tu7NYoGY4Yoc7I+Npf9HhUMtEEpV7ZiLH9yndTCoNhcpBH0kwcvFbzYN9/u5QKI5A6uefjsNNWaz5olJVYS62Q==
dependencies:
follow-redirects "^1.14.9"
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

babel-jest@^28.1.2:
version "28.1.2"
Expand Down Expand Up @@ -3534,10 +3535,10 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==

follow-redirects@^1.14.9:
version "1.15.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5"
integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==
follow-redirects@^1.15.0:
version "1.15.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==

forever-agent@~0.6.1:
version "0.6.1"
Expand Down Expand Up @@ -5820,6 +5821,11 @@ propagate@^2.0.0:
resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45"
integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

psl@^1.1.28:
version "1.8.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24"
Expand Down

0 comments on commit d8bab9b

Please sign in to comment.