fix(HTTP Request Node): Fix AWS credentials to stop removing url params for STS (#5790)

This commit is contained in:
Jon 2023-03-27 16:56:02 +01:00 committed by GitHub
parent 0625e2e6bc
commit a1306c6903
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,7 +285,7 @@ export class Aws implements ICredentialType {
const method = requestOptions.method;
let body = requestOptions.body;
let region = credentials.region;
const query = requestOptions.qs?.query as IDataObject;
let query = requestOptions.qs?.query as IDataObject;
// ! Workaround as we still use the OptionsWithUri interface which uses uri instead of url
// ! To change when we replace the interface with IHttpRequestOptions
@ -295,8 +295,12 @@ export class Aws implements ICredentialType {
endpoint = new URL(requestOptions.url);
if (service === 'sts') {
try {
endpoint.searchParams.set('Action', 'GetCallerIdentity');
endpoint.searchParams.set('Version', '2011-06-15');
if (requestWithUri.qs?.Action !== 'GetCallerIdentity') {
query = requestWithUri.qs;
} else {
endpoint.searchParams.set('Action', 'GetCallerIdentity');
endpoint.searchParams.set('Version', '2011-06-15');
}
} catch (err) {
console.log(err);
}
@ -342,6 +346,7 @@ export class Aws implements ICredentialType {
endpoint = customUrl;
}
}
if (query && Object.keys(query).length !== 0) {
Object.keys(query).forEach((key) => {
endpoint.searchParams.append(key, query[key] as string);