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) 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[]> const vars = useStream(restVars$, [], setRESTVars) as Ref<HoppRESTVar[]>
// The UI representation of the variables list (has the empty end variable) // 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 // Sync logic between params and working/bulk params
watch( watch(
vars, vars,
(newParamsList) => { (newVarsList) => {
// Sync should overwrite working params // Sync should overwrite working params
const filteredWorkingVars: HoppRESTVar[] = pipe( const filteredWorkingVars: HoppRESTVar[] = pipe(
workingVars.value, workingVars.value,
@@ -133,9 +134,9 @@ watch(
) )
) )
if (!isEqual(newParamsList, filteredWorkingVars)) { if (!isEqual(newVarsList, filteredWorkingVars)) {
workingVars.value = pipe( workingVars.value = pipe(
newParamsList, newVarsList,
A.map((x) => ({ id: idTicker.value++, ...x })) A.map((x) => ({ id: idTicker.value++, ...x }))
) )
} }

View File

@@ -30,7 +30,12 @@ export const getDefaultRESTRequest = (): HoppRESTRequest => ({
endpoint: "https://echo.hoppscotch.io", endpoint: "https://echo.hoppscotch.io",
name: "Untitled request", name: "Untitled request",
params: [], params: [],
vars: [], vars: [
{
key: "amount",
value: "23",
},
],
headers: [], headers: [],
method: "GET", method: "GET",
auth: { auth: {

View File

@@ -8,7 +8,7 @@ import { lodashIsEqualEq, mapThenEq, undefinedEq } from "../utils/eq"
export * from "./content-types" export * from "./content-types"
export * from "./HoppRESTAuth" export * from "./HoppRESTAuth"
export const RESTReqSchemaVersion = "2" export const RESTReqSchemaVersion = "1"
export type HoppRESTParam = { export type HoppRESTParam = {
key: string key: string