Failed Http Request when using content


I am using a RESTful web service where I would like to add data from our unreal game client.
I have read the official documentation and some other threads on how to send those requests to a server(Get Http Module to work with HTTPS How to Make Http GET request in C++), am still not sure if the order of instructions matters, please let me know if what I am using look correct

	TSharedRef<IHttpRequest> Request = HttpModule->CreateRequest();
	Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
	Request->OnProcessRequestComplete().BindUObject(this, &AMyGameMode::OnResponseReceived);

I get an OK response from the server when executing the above, apparently the authentication is correct.

The problem arises when I start using any content in the request (either SetContentAsString, even from a file stream),
you can read the full log in the log.txt file attachedlog error when requesting with content, sufficient to say
that the server returns libcurl error: 52 (Server returned nothing (no headers, no data))

Even with the simplest body it return the same error, same with POST verbs, the ones I am interested in .

GET myndex/_search

Which translates into C++ code like

	FString content("myindex/_search {}");

Even if the content is stored in a json file and passed as I get the same error, which verifies that my json format is correct.


Is there anything else left on my side, or would this be related to the server I am using?

Appreciate any help.

This happened to me when using a “GET” verb and setting content via “SetContentAsString”. The resolution for me was instead to construct the URL with the appropriate query following the question mark (http://myserver.local?myqueryparam=somethinghere), and not setting content on the request at all.

AFAIK Only set the content if you are using “POST” or “PUT”.