# Failed Http Request when using content

**URL:** <https://forums.unrealengine.com/t/failed-http-request-when-using-content/459459>\
**Category:** C++\
**Tags:** httprequest, unreal-engine, UE4, question, CPP\
**Created:** [December 12, 2019, 7:25pm UTC](https://forums.unrealengine.com/t/failed-http-request-when-using-content/459459 "2019-12-12T19:25:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![isaacvega](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@isaacvega](https://forums.unrealengine.com/u/isaacvega)\
**Post date:** [December 12, 2019, 7:25pm UTC](https://forums.unrealengine.com/t/failed-http-request-when-using-content/459459/1 "2019-12-12T19:25:32Z")

</div>

Hi,

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](https://answers.unrealengine.com/questions/225817/view.html)[How to Make Http GET request in C++](https://wiki.unrealengine.com/UE4.10_How_To_Make_HTTP_GET_Request_in_C%2B%2B)), 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->SetURL("https://user:pass@mysite.com:445");
	Request->SetVerb("GET");
	Request->OnProcessRequestComplete().BindUObject(this, &AMyGameMode::OnResponseReceived);
	Request->ProcessRequest();

```

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 {}");
	Request->SetContentAsString(content);

```

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.

```
Request->SetContentAsStreamedFile(myJsonFile);

```

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

Appreciate any help.  
Regards

---

<div class="post-metadata">

**Author:** ![Spkr](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/spkr/32/1196504_2.png) [@Spkr](https://forums.unrealengine.com/u/Spkr)\
**Post date:** [July 29, 2020, 5:31pm UTC](https://forums.unrealengine.com/t/failed-http-request-when-using-content/459459/2 "2020-07-29T17:31:01Z")

</div>

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](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”.
