Created default value for HoppRESTRequest for testing

This commit is contained in:
Jason Casareno
2022-07-27 17:47:37 -07:00
parent 5413bc584a
commit 8aa066e2ab
3 changed files with 11 additions and 5 deletions

View File

@@ -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<HoppRESTVar[]>
// 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 }))
)
}

View File

@@ -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: {

View File

@@ -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