From 05f573d181654c362dd4c76649de2b8415c6cb5a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sun, 24 May 2020 07:38:03 -0400 Subject: [PATCH] Added check if content-type header is present for transformResponse --- functions/strategies/AxiosStrategy.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions/strategies/AxiosStrategy.js b/functions/strategies/AxiosStrategy.js index f38a94064..1deda3333 100644 --- a/functions/strategies/AxiosStrategy.js +++ b/functions/strategies/AxiosStrategy.js @@ -15,9 +15,10 @@ const axiosWithoutProxy = async (req, _store) => { (data, headers) => { // If the response has a JSON content type, try parsing it if ( - headers["content-type"].startsWith("application/json") || - headers["content-type"].startsWith("application/vnd.api+json") || - headers["content-type"].startsWith("application/hal+json") + headers["content-type"] && + (headers["content-type"].startsWith("application/json") || + headers["content-type"].startsWith("application/vnd.api+json") || + headers["content-type"].startsWith("application/hal+json")) ) { try { const jsonData = JSON.parse(data)