diff --git a/packages/bruno-app/src/components/RequestPane/QueryEditor/index.js b/packages/bruno-app/src/components/RequestPane/QueryEditor/index.js index cfae50536..d588c78d6 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryEditor/index.js +++ b/packages/bruno-app/src/components/RequestPane/QueryEditor/index.js @@ -163,7 +163,6 @@ export default class QueryEditor extends React.Component { let variables = getEnvironmentVariables(this.props.collection); if (!isEqual(variables, this.variables)) { this.editor.options.brunoVarInfo.variables = variables; - console.log(variables); this.addOverlay(); } } @@ -180,7 +179,6 @@ export default class QueryEditor extends React.Component { addOverlay = () => { let variables = getEnvironmentVariables(this.props.collection); this.variables = variables; - console.log(variables); defineCodeMirrorBrunoVariablesMode(variables, 'graphql'); this.editor.setOption('mode', 'brunovariables'); diff --git a/packages/bruno-app/src/components/ResponsePane/Timeline/index.js b/packages/bruno-app/src/components/ResponsePane/Timeline/index.js index 75477f8f7..4930794b5 100644 --- a/packages/bruno-app/src/components/ResponsePane/Timeline/index.js +++ b/packages/bruno-app/src/components/ResponsePane/Timeline/index.js @@ -1,5 +1,6 @@ import React from 'react'; import forOwn from 'lodash/forOwn'; +import { safeStringifyJSON } from 'utils/common'; import StyledWrapper from './StyledWrapper'; const Timeline = ({ item }) => { @@ -15,6 +16,8 @@ const Timeline = ({ item }) => { }); }); + let requestData = safeStringifyJSON(request.data); + return (
@@ -29,9 +32,11 @@ const Timeline = ({ item }) => { ); })} -
-          {'>'} data {request.data ? request.data : 'null'}
-        
+ {requestData ? ( +
+            {'>'} data {requestData}
+          
+ ) : null}
diff --git a/packages/bruno-app/src/utils/common/index.js b/packages/bruno-app/src/utils/common/index.js index b88c587e2..20afbc5f1 100644 --- a/packages/bruno-app/src/utils/common/index.js +++ b/packages/bruno-app/src/utils/common/index.js @@ -24,3 +24,25 @@ export const waitForNextTick = () => { setTimeout(() => resolve(), 0); }); }; + +export const safeParseJSON = (str) => { + if(!str || !str.length || typeof str !== 'string') { + return str; + } + try { + return JSON.parse(str); + } catch (e) { + return str; + } +}; + +export const safeStringifyJSON = (obj) => { + if(!obj) { + return obj; + } + try { + return JSON.stringify(obj); + } catch (e) { + return obj; + } +}