Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: include request body to AWS V4 signer in effective request functions (#5084)
Anwarul Islam130facb44092
diff --git a/packages/hoppscotch-cli/src/utils/pre-request.ts b/packages/hoppscotch-cli/src/utils/pre-request.tsindex f8bca56e5..4f012278d 100644--- a/packages/hoppscotch-cli/src/utils/pre-request.ts+++ b/packages/hoppscotch-cli/src/utils/pre-request.ts@@ -202,8 +202,11 @@ export async function getEffectiveRESTRequest(const amzDate = currentDate.toISOString().replace(/[:-]|\.\d{3}/g, "");const { method, endpoint } = request;+ const body = getFinalBodyFromRequest(request, resolvedVariables);+const signer = new AwsV4Signer({method,+ body: E.isRight(body) ? body.right?.toString() : undefined,datetime: amzDate,signQuery: addTo === "QUERY_PARAMS",accessKeyId: parseTemplateString(diff --git a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.tsindex a346b1276..2ff0e82ed 100644--- a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts+++ b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts@@ -222,8 +222,12 @@ export const getComputedAuthHeaders = async (const currentDate = new Date()const amzDate = currentDate.toISOString().replace(/[:-]|\.\d{3}/g, "")const { method, endpoint } = req as HoppRESTRequest++ const body = getFinalBodyFromRequest(request, envVars)+const signer = new AwsV4Signer({method: method,+ body: body?.toString(),datetime: amzDate,accessKeyId: parseTemplateString(request.auth.accessKey, envVars),secretAccessKey: parseTemplateString(request.auth.secretKey, envVars),