fix: patch bug temporarily

This commit is contained in:
Anoop M D 2023-01-29 13:09:33 +05:30
parent cd36335c60
commit b2c28465e9

View File

@ -14,6 +14,22 @@ Mustache.escape = function (value) {
return value; return value;
}; };
const safeStringifyJSON = (data) => {
try {
return JSON.stringify(data);
} catch (e) {
return data;
}
};
const safeParseJSON = (data) => {
try {
return JSON.parse(data);
} catch (e) {
return data;
}
};
const getEnvVars = (environment = {}) => { const getEnvVars = (environment = {}) => {
const variables = environment.variables; const variables = environment.variables;
if (!variables || !variables.length) { if (!variables || !variables.length) {
@ -68,12 +84,16 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
} }
interpolateVars(request, envVars); interpolateVars(request, envVars);
// todo:
// i have no clue why electron can't send the request object
// without safeParseJSON(safeStringifyJSON(request.data))
mainWindow.webContents.send('main:http-request-sent', { mainWindow.webContents.send('main:http-request-sent', {
requestSent: { requestSent: {
url: request.url, url: request.url,
method: request.method, method: request.method,
headers: request.headers, headers: request.headers,
data: request.data data: safeParseJSON(safeStringifyJSON(request.data))
}, },
collectionUid, collectionUid,
itemUid: item.uid, itemUid: item.uid,