`signQuery` doesn't sign using the query parameters
andrestone opened this issue · comments
André Fontenele commented
The signQuery
option tells aws4
to sign the request using query parameters but ignores the relevant output.
Where
// src/interceptor.ts
/* ... */
signQuery: options?.signQuery,
body: transformedData,
headers: headersToSign,
};
const resolvedCredentials = await credentialsProvider.getCredentials();
sign(signingOptions, resolvedCredentials);
config.headers = signingOptions.headers;
// Huh? What about `url`?
return config;
To reproduce:
// repro.ts
import axios from "axios";
import { aws4Interceptor } from "aws4-axios";
(async () => {
const agent = axios.create();
agent.interceptors.request.use((request) => {
console.log("Final URL: ", request.url); // Final URL: https://localhost/?iamstill=thesame
console.log("Headers: ", request.headers); // Headers: { Host: 'localhost' }
return request;
});
agent.interceptors.request.use(
aws4Interceptor(
{
region: "area51",
service: "beer",
signQuery: true,
},
{
accessKeyId: "aki",
secretAccessKey: "sak",
}
)
);
try {
return await agent.request({
url: "https://localhost/?iamstill=thesame",
});
} catch (e) {}
})();
James Bourne commented
Hey @andrestone, thanks for the report! This should be fixed by #226