fix: sidebar codegen crashing and AWS Signature Auth flow (#4315)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
This commit is contained in:
Andrew Bastin
2024-09-01 21:25:06 +05:30
committed by GitHub
parent c2fb6aee3f
commit 519b520913
7 changed files with 63 additions and 26 deletions

View File

@@ -247,7 +247,7 @@ export function runRESTRequest$(
combineEnvVariables(finalEnvs)
)
const effectiveRequest = getEffectiveRESTRequest(finalRequest, {
const effectiveRequest = await getEffectiveRESTRequest(finalRequest, {
id: "env-id",
v: 1,
name: "Env",
@@ -321,7 +321,7 @@ export function runRESTRequest$(
{
name: env.name,
v: 1,
id: env.id ?? "",
id: "id" in env ? env.id : "",
variables: updatedRunResult.envs.selected,
}
)

View File

@@ -1,30 +1,32 @@
import {
Environment,
FormDataKeyValue,
HoppRESTAuth,
HoppRESTHeader,
HoppRESTHeaders,
HoppRESTParam,
HoppRESTParams,
HoppRESTReqBody,
HoppRESTRequest,
parseBodyEnvVariables,
parseRawKeyValueEntriesE,
parseTemplateString,
parseTemplateStringE,
} from "@hoppscotch/data"
import { AwsV4Signer } from "aws4fetch"
import * as A from "fp-ts/Array"
import * as E from "fp-ts/Either"
import { flow, pipe } from "fp-ts/function"
import * as O from "fp-ts/Option"
import * as RA from "fp-ts/ReadonlyArray"
import * as S from "fp-ts/string"
import qs from "qs"
import { flow, pipe } from "fp-ts/function"
import { combineLatest, Observable } from "rxjs"
import { map } from "rxjs/operators"
import {
FormDataKeyValue,
HoppRESTReqBody,
HoppRESTRequest,
parseTemplateString,
parseBodyEnvVariables,
Environment,
HoppRESTHeader,
HoppRESTParam,
parseRawKeyValueEntriesE,
parseTemplateStringE,
HoppRESTAuth,
HoppRESTHeaders,
} from "@hoppscotch/data"
import { arrayFlatMap, arraySort } from "../functional/array"
import { toFormData } from "../functional/formData"
import { tupleWithSameKeysToRecord } from "../functional/record"
import { AwsV4Signer } from "aws4fetch"
export interface EffectiveHoppRESTRequest extends HoppRESTRequest {
/**
@@ -33,8 +35,8 @@ export interface EffectiveHoppRESTRequest extends HoppRESTRequest {
* This contains path, params and environment variables all applied to it
*/
effectiveFinalURL: string
effectiveFinalHeaders: { key: string; value: string }[]
effectiveFinalParams: { key: string; value: string }[]
effectiveFinalHeaders: HoppRESTHeaders
effectiveFinalParams: HoppRESTParams
effectiveFinalBody: FormData | string | null
effectiveFinalRequestVariables: { key: string; value: string }[]
}
@@ -502,6 +504,7 @@ export async function getEffectiveRESTRequest(
false,
showKeyIfSecret
),
description: x.description,
}))
)
@@ -525,6 +528,7 @@ export async function getEffectiveRESTRequest(
false,
showKeyIfSecret
),
description: x.description,
}))
)