mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 14:41:04 +01:00
fix: patch bug temporarily
This commit is contained in:
parent
cd36335c60
commit
b2c28465e9
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user