fix: decomment not working in json body (#1819)

Request body json was not decommented if json parsing fails, which
would happen if variables are not quoted.

Fixes usebruno#888
This commit is contained in:
Antti Sonkeri
2024-06-19 13:48:36 +03:00
committed by GitHub
parent a0df5138b3
commit 9c11e27d1c
4 changed files with 48 additions and 4 deletions

View File

@@ -76,10 +76,11 @@ const prepareRequest = (request, collectionRoot) => {
if (!contentTypeDefined) {
axiosRequest.headers['content-type'] = 'application/json';
}
const jsonBody = decomment(request.body.json);
try {
axiosRequest.data = JSONbig.parse(decomment(request.body.json));
axiosRequest.data = JSONbig.parse(jsonBody);
} catch (ex) {
axiosRequest.data = request.body.json;
axiosRequest.data = jsonBody;
}
}