From e24ca5865409806e8c50abd1687f6af805d1b80c Mon Sep 17 00:00:00 2001 From: "v.alyamkin" Date: Wed, 30 May 2018 12:07:43 +0300 Subject: [PATCH] Don't cleanup response content for invalid json strings. #166 WIP --- Source/VaRestPlugin/Private/VaRestRequestJSON.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/VaRestPlugin/Private/VaRestRequestJSON.cpp b/Source/VaRestPlugin/Private/VaRestRequestJSON.cpp index d61aab72..5e88324f 100644 --- a/Source/VaRestPlugin/Private/VaRestRequestJSON.cpp +++ b/Source/VaRestPlugin/Private/VaRestRequestJSON.cpp @@ -546,8 +546,15 @@ bool UVaRestRequestJSON::HasTag(FName Tag) const FString UVaRestRequestJSON::GetResponseContentAsString(bool bCacheResponseContent) { - // Check we have valide response - if (!bIsValidJsonResponse || !ResponseJsonObj || !ResponseJsonObj->IsValidLowLevel()) + // Check we have valid json response + if (!bIsValidJsonResponse) + { + // We've cached response content in OnProcessRequestComplete() + return ResponseContent; + } + + // Check we have valid response object + if (!ResponseJsonObj || !ResponseJsonObj->IsValidLowLevel()) { // Discard previous cached string if we had one ResponseContent = DeprecatedResponseString;