From 736b6bc84c8e5de8c1d608d3529378d5fa95a3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Ormaechea?= Date: Thu, 25 Jul 2019 20:30:38 -0300 Subject: [PATCH] Fixed undefined and null responseParameter values --- src/ApiGateway.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ApiGateway.js b/src/ApiGateway.js index 215f8ff4a..0721e8fcb 100644 --- a/src/ApiGateway.js +++ b/src/ApiGateway.js @@ -656,10 +656,18 @@ module.exports = class ApiGateway { if (value.startsWith('integration.response')) { if (valueArray[2] === 'body') { debugLog('Found body in right-hand'); - headerValue = (valueArray[3] - ? jsonPath(result, valueArray.slice(3).join('.')) - : result - ).toString(); + headerValue = (valueArray[3] + ? jsonPath(result, valueArray.slice(3).join('.')) + : result + ); + if(typeof headerValue === 'undefined' || headerValue === null) { + debugLog( + `Warning: empty value for responseParameter "${key}": "${value}"`, + ); + headerValue = ''; + } else { + headerValue = headerValue.toString(); + } } else { this.printBlankLine(); this.log(