Test scripts get parsed JSON body
This commit is contained in:
parent
b7b721abd5
commit
8a07f281ff
1 changed files with 13 additions and 0 deletions
|
|
@ -2200,6 +2200,19 @@ export default {
|
|||
body: this.response.body,
|
||||
headers: this.response.headers,
|
||||
}
|
||||
|
||||
// Parse JSON body
|
||||
if (
|
||||
syntheticResponse.headers["content-type"] &&
|
||||
isJSONContentType(syntheticResponse.headers["content-type"])
|
||||
) {
|
||||
try {
|
||||
syntheticResponse.body = JSON.parse(
|
||||
new TextDecoder("utf-8").decode(new Uint8Array(syntheticResponse.body))
|
||||
)
|
||||
} catch (_e) {}
|
||||
}
|
||||
|
||||
const { testResults } = runTestScriptWithVariables(this.testScript, {
|
||||
response: syntheticResponse,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue