Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Wrap headers with AxiosHeaders to prevent incorrect type being passed #1248

Merged
merged 4 commits into from
Feb 11, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ export const aws4Interceptor = <D = any>({
}

const { host, pathname, search } = new URL(url);
const { data, headers, method } = config;
const { data, method } = config;
const headers = new AxiosHeaders(config.headers);
Comment on lines -133 to +134
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't fix the bug everywhere, you should fix the actual headers when they are set at line 170:

https://github.com/jamesmbourne/aws4-axios/pull/1248/files#diff-bc2f1f907be8c49520a585dda7f0c100645e31e9bedf3828c3850fdf8389e619R170

config.headers = signingOptions.headers as AxiosHeaders;

This should not be casted but should be a real AxiosHeaders instance. Otherwise this lib will still break axios for every other uses outside this lib.


const transformRequest = getTransformer(config);

Expand Down