From acbad678badc37039fb2c41d0d843e40a1db162d Mon Sep 17 00:00:00 2001 From: Vladimir Alyamkin Date: Thu, 26 Aug 2021 19:32:51 +0300 Subject: [PATCH] Fix content-length issue for get requests. Close #354. Close #99. --- Source/VaRest/Private/VaRestRequestJSON.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/VaRest/Private/VaRestRequestJSON.cpp b/Source/VaRest/Private/VaRestRequestJSON.cpp index 576fc638..ab998d2d 100644 --- a/Source/VaRest/Private/VaRestRequestJSON.cpp +++ b/Source/VaRest/Private/VaRestRequestJSON.cpp @@ -420,6 +420,12 @@ void UVaRestRequestJSON::ProcessRequest() { HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json")); + // Body is ignored for get requests, so we shouldn't place json into it even if it's empty + if(RequestVerb == EVaRestRequestVerb::GET) + { + break; + } + // Serialize data to json string FString OutputString; TSharedRef> Writer = TJsonWriterFactory<>::Create(&OutputString);