diff --git a/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts b/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts index 72ec41b8e..01ce0962d 100644 --- a/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts +++ b/packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts @@ -137,7 +137,7 @@ describe("hopp test [options] ", () => { expect(error).toBeNull(); }, - { timeout: 50000 } + { timeout: 100000 } ); test("Persists environment variables set in the pre-request script for consumption in the test script", async () => { @@ -366,7 +366,7 @@ describe("hopp test [options] ", () => { expect(error).toBeNull(); }); }, - { timeout: 20000 } + { timeout: 50000 } ); describe("Request variables", () => { diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 15a8d96a7..0733917d6 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -101,7 +101,8 @@ "updated_text": "Hoppscotch has been updated to v{version} 🎉", "whats_new": "What's new?", "see_whats_new": "See what’s new", - "wiki": "Wiki" + "wiki": "Wiki", + "default": "default: {value}" }, "auth": { "account_exists": "Account exists with different credential - Login to link both accounts", diff --git a/packages/hoppscotch-common/src/components/graphql/Authorization.vue b/packages/hoppscotch-common/src/components/graphql/Authorization.vue index c61319c55..4ab5feadb 100644 --- a/packages/hoppscotch-common/src/components/graphql/Authorization.vue +++ b/packages/hoppscotch-common/src/components/graphql/Authorization.vue @@ -246,6 +246,22 @@ const selectOAuth2AuthType = () => { } } +const selectAPIKeyAuthType = () => { + auth.value = { + ...auth.value, + authType: "api-key", + addTo: "HEADERS", + } as HoppGQLAuth +} + +const selectAWSSignatureAuthType = () => { + auth.value = { + ...auth.value, + authType: "aws-signature", + addTo: "HEADERS", + } as HoppGQLAuth +} + const authTypes: AuthType[] = [ { key: "inherit", @@ -271,10 +287,12 @@ const authTypes: AuthType[] = [ { key: "api-key", label: "API Key", + handler: selectAPIKeyAuthType, }, { key: "aws-signature", label: "AWS Signature", + handler: selectAWSSignatureAuthType, }, ] diff --git a/packages/hoppscotch-common/src/components/graphql/Headers.vue b/packages/hoppscotch-common/src/components/graphql/Headers.vue index c2cb058b7..51c4bb974 100644 --- a/packages/hoppscotch-common/src/components/graphql/Headers.vue +++ b/packages/hoppscotch-common/src/components/graphql/Headers.vue @@ -591,6 +591,7 @@ const getComputedAuthHeaders = async ( region: request.auth.region ?? "us-east-1", service: request.auth.serviceName, url, + sessionToken: request.auth.serviceToken, }) const sign = await signer.sign() diff --git a/packages/hoppscotch-common/src/components/http/Authorization.vue b/packages/hoppscotch-common/src/components/http/Authorization.vue index fa9c598f7..a13f1433d 100644 --- a/packages/hoppscotch-common/src/components/http/Authorization.vue +++ b/packages/hoppscotch-common/src/components/http/Authorization.vue @@ -170,20 +170,18 @@ diff --git a/packages/hoppscotch-common/src/helpers/graphql/connection.ts b/packages/hoppscotch-common/src/helpers/graphql/connection.ts index e4fc846b0..b41e3e734 100644 --- a/packages/hoppscotch-common/src/helpers/graphql/connection.ts +++ b/packages/hoppscotch-common/src/helpers/graphql/connection.ts @@ -288,7 +288,8 @@ export const runGQLOperation = async (options: RunQueryOptions) => { params[key] = value } } else if (auth.authType === "aws-signature") { - const { accessKey, secretKey, region, serviceName, addTo } = auth + const { accessKey, secretKey, region, serviceName, addTo, serviceToken } = + auth const currentDate = new Date() const amzDate = currentDate.toISOString().replace(/[:-]|\.\d{3}/g, "") @@ -301,6 +302,7 @@ export const runGQLOperation = async (options: RunQueryOptions) => { region: region ?? "us-east-1", service: serviceName, url, + sessionToken: serviceToken, }) const sign = await signer.sign() diff --git a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts index 239e6c319..1b1bcaf03 100644 --- a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts +++ b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts @@ -146,6 +146,9 @@ export const getComputedAuthHeaders = async ( region: parseTemplateString(request.auth.region, envVars) ?? "us-east-1", service: parseTemplateString(request.auth.serviceName, envVars), + sessionToken: + request.auth.serviceToken && + parseTemplateString(request.auth.serviceToken, envVars), url: parseTemplateString(endpoint, envVars), }) @@ -290,6 +293,9 @@ export const getComputedParams = async ( secretAccessKey: parseTemplateString(req.auth.secretKey, envVars), region: parseTemplateString(req.auth.region, envVars) ?? "us-east-1", service: parseTemplateString(req.auth.serviceName, envVars), + sessionToken: + req.auth.serviceToken && + parseTemplateString(req.auth.serviceToken, envVars), url: parseTemplateString(req.endpoint, envVars), }) const sign = await signer.sign()