From 8aa066e2abd7d3135128146b03b6e07a051c27a0 Mon Sep 17 00:00:00 2001 From: Jason Casareno Date: Wed, 27 Jul 2022 17:47:37 -0700 Subject: [PATCH] Created default value for HoppRESTRequest for testing --- packages/hoppscotch-app/components/http/Variables.vue | 7 ++++--- packages/hoppscotch-app/newstore/RESTSession.ts | 7 ++++++- packages/hoppscotch-data/src/rest/index.ts | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-app/components/http/Variables.vue b/packages/hoppscotch-app/components/http/Variables.vue index e0493e064..0590a6a47 100644 --- a/packages/hoppscotch-app/components/http/Variables.vue +++ b/packages/hoppscotch-app/components/http/Variables.vue @@ -96,6 +96,7 @@ const idTicker = ref(0) const deletionToast = ref<{ goAway: (delay: number) => void } | null>(null) +// The functional variables list (the variables actually applied to the session) const vars = useStream(restVars$, [], setRESTVars) as Ref // The UI representation of the variables list (has the empty end variable) @@ -121,7 +122,7 @@ watch(workingVars, (varsList) => { // Sync logic between params and working/bulk params watch( vars, - (newParamsList) => { + (newVarsList) => { // Sync should overwrite working params const filteredWorkingVars: HoppRESTVar[] = pipe( workingVars.value, @@ -133,9 +134,9 @@ watch( ) ) - if (!isEqual(newParamsList, filteredWorkingVars)) { + if (!isEqual(newVarsList, filteredWorkingVars)) { workingVars.value = pipe( - newParamsList, + newVarsList, A.map((x) => ({ id: idTicker.value++, ...x })) ) } diff --git a/packages/hoppscotch-app/newstore/RESTSession.ts b/packages/hoppscotch-app/newstore/RESTSession.ts index 7a9e7cfe4..5d00070de 100644 --- a/packages/hoppscotch-app/newstore/RESTSession.ts +++ b/packages/hoppscotch-app/newstore/RESTSession.ts @@ -30,7 +30,12 @@ export const getDefaultRESTRequest = (): HoppRESTRequest => ({ endpoint: "https://echo.hoppscotch.io", name: "Untitled request", params: [], - vars: [], + vars: [ + { + key: "amount", + value: "23", + }, + ], headers: [], method: "GET", auth: { diff --git a/packages/hoppscotch-data/src/rest/index.ts b/packages/hoppscotch-data/src/rest/index.ts index 89ce2b89d..a9fb8aa12 100644 --- a/packages/hoppscotch-data/src/rest/index.ts +++ b/packages/hoppscotch-data/src/rest/index.ts @@ -8,7 +8,7 @@ import { lodashIsEqualEq, mapThenEq, undefinedEq } from "../utils/eq" export * from "./content-types" export * from "./HoppRESTAuth" -export const RESTReqSchemaVersion = "2" +export const RESTReqSchemaVersion = "1" export type HoppRESTParam = { key: string