From 1ca3cc4636961d1816f73f131d5f09fd22ed0a1c Mon Sep 17 00:00:00 2001 From: Maayan Glikser Date: Sun, 27 May 2018 00:02:59 +0300 Subject: [PATCH] fix(request log): fix an issue where no params showed as binary data in request log --- lib/ui/components/RequestLogs/RequestRow.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ui/components/RequestLogs/RequestRow.js b/lib/ui/components/RequestLogs/RequestRow.js index fc7190ba..cb9fed59 100644 --- a/lib/ui/components/RequestLogs/RequestRow.js +++ b/lib/ui/components/RequestLogs/RequestRow.js @@ -3,6 +3,7 @@ import styled from 'styled-components'; import find from 'lodash/find'; import isString from 'lodash/isString'; import isNull from 'lodash/isNull'; +import isUndefined from 'lodash/isUndefined'; import get from 'lodash/get'; import API from 'api'; import UIState from 'ui/states/UIState'; @@ -76,6 +77,8 @@ const editRequest = (request) => (event) => { UIState.setViewMode('mocks'); }; +const isNullOrUndefined = (value) => isNull(value) || isUndefined(value); + const RequestRow = ({ request, onSelect, selected, getCellWidth, query }) => { const body = get(request, 'mock.response.body', request.response.body); @@ -106,7 +109,7 @@ const RequestRow = ({ request, onSelect, selected, getCellWidth, query }) => { - { !isString(request.params) && !isNull(request.params) ? 'binary data' : request.params } + { !isString(request.params) && !isNullOrUndefined(request.params) ? 'binary data' : request.params } @@ -118,7 +121,7 @@ const RequestRow = ({ request, onSelect, selected, getCellWidth, query }) => { - { !isString(body) && !isNull(body) ? 'binary data' : body } + { !isString(body) && !isNullOrUndefined(body) ? 'binary data' : body } {