fix: parsing
This commit is contained in:
committed by
Andrew Bastin
parent
f428a21279
commit
5dcfa66c5d
@@ -109,5 +109,9 @@ function parseV1ExtURL(urlParams: Record<string, any>): HoppRESTRequest {
|
|||||||
resolvedReq.endpoint = urlParams.endpoint
|
resolvedReq.endpoint = urlParams.endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (urlParams.body && typeof urlParams.body === "string") {
|
||||||
|
resolvedReq.body = JSON.parse(urlParams.body)
|
||||||
|
}
|
||||||
|
|
||||||
return resolvedReq
|
return resolvedReq
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,15 +164,14 @@ function bindRequestToURLParams() {
|
|||||||
return filtered.length > 0 ? JSON.stringify(filtered) : null
|
return filtered.length > 0 ? JSON.stringify(filtered) : null
|
||||||
})
|
})
|
||||||
|
|
||||||
const contentType = request.value.body.contentType
|
|
||||||
|
|
||||||
const body = computed(() => {
|
const body = computed(() => {
|
||||||
|
const contentType = request.value.body.contentType
|
||||||
if (contentType === "multipart/form-data") {
|
if (contentType === "multipart/form-data") {
|
||||||
const body = request.value.body.body as FormDataKeyValue[]
|
const body = request.value.body.body as FormDataKeyValue[]
|
||||||
const filtered = body.filter((x) => x.key !== "")
|
const filtered = body.filter((x) => x.key !== "")
|
||||||
return filtered.length > 0 ? JSON.stringify(filtered) : null
|
return JSON.stringify({ body: filtered, contentType })
|
||||||
}
|
}
|
||||||
return JSON.stringify(request.value.body)
|
return JSON.stringify({ body: request.value.body.body, contentType })
|
||||||
})
|
})
|
||||||
|
|
||||||
// Combine them together to a cleaner value
|
// Combine them together to a cleaner value
|
||||||
@@ -182,7 +181,7 @@ function bindRequestToURLParams() {
|
|||||||
endpoint: request.value.endpoint,
|
endpoint: request.value.endpoint,
|
||||||
headers: headers.value,
|
headers: headers.value,
|
||||||
params: params.value,
|
params: params.value,
|
||||||
body: JSON.stringify({ contentType, body }),
|
body: body.value,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Watch and update accordingly
|
// Watch and update accordingly
|
||||||
|
|||||||
Reference in New Issue
Block a user