From cc261326fc3d4ef93b3244262becd84b7c24357c Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sun, 29 Jan 2023 14:17:01 +0530 Subject: [PATCH] fix: fixed env var issues --- .../VariablesTable/StyledWrapper.js | 10 ++++++++++ .../VariablesView/VariablesTable/index.js | 20 +++++++++---------- .../bruno-electron/src/ipc/network/index.js | 3 +++ .../src/ipc/network/interpolate-vars.js | 7 ++++--- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/bruno-app/src/components/VariablesView/VariablesTable/StyledWrapper.js b/packages/bruno-app/src/components/VariablesView/VariablesTable/StyledWrapper.js index a3fb048ee..3551b5652 100644 --- a/packages/bruno-app/src/components/VariablesView/VariablesTable/StyledWrapper.js +++ b/packages/bruno-app/src/components/VariablesView/VariablesTable/StyledWrapper.js @@ -4,6 +4,16 @@ const StyledWrapper = styled.div` .variable-name { color: ${(props) => props.theme.variables.name.color}; } + + .variable-name{ + width:100px; + } + + .variable-value { + max-width: 500px; + inline-size: 500px; + overflow-wrap: break-word; + } ` export default StyledWrapper; \ No newline at end of file diff --git a/packages/bruno-app/src/components/VariablesView/VariablesTable/index.js b/packages/bruno-app/src/components/VariablesView/VariablesTable/index.js index 19d13fd51..733be81b1 100644 --- a/packages/bruno-app/src/components/VariablesView/VariablesTable/index.js +++ b/packages/bruno-app/src/components/VariablesView/VariablesTable/index.js @@ -4,16 +4,16 @@ import StyledWrapper from './StyledWrapper'; const VariablesTable = ({ variables }) => { return ( - - - {variables.map((variable) => ( - - - - - ))} - -
{variable.name}{variable.value}
+
+ {(variables && variables.length) ? variables.map((variable) => { + return ( +
+
{variable.name}
+
{variable.value}
+
+ ); + }) : null} +
); }; diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index b031e0533..fb6618ada 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -128,6 +128,9 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => { data: result.data }; } catch (error) { + // todo: better error handling + // need to convey the error to the UI + // and need not be always a network error deleteCancelToken(cancelTokenUid); if(error.response) { diff --git a/packages/bruno-electron/src/ipc/network/interpolate-vars.js b/packages/bruno-electron/src/ipc/network/interpolate-vars.js index 291b928fa..a0db91205 100644 --- a/packages/bruno-electron/src/ipc/network/interpolate-vars.js +++ b/packages/bruno-electron/src/ipc/network/interpolate-vars.js @@ -1,5 +1,5 @@ const Mustache = require('mustache'); -const { each, get } = require('lodash'); +const { each, get, forOwn } = require('lodash'); // override the default escape function to prevent escaping Mustache.escape = function (value) { @@ -17,9 +17,10 @@ const interpolateVars = (request, envVars = {}) => { request.url = interpolate(request.url); - each(request.headers, (header) => { - header.value = interpolate(header.value); + forOwn(request.headers, (value, key) => { + request.headers[key] = interpolate(value); }); + each(request.params, (param) => { param.value = interpolate(param.value); });