I am working on communications between my game and a cloud database. I'm working on the authentication part but when I try to pass data to the server in a POST the engine crashes. If I pass in a simple string like "username" it does not crash and I get an error response from the server as expected. But when I try to pass in a JSON string the engine crashes. Here is my code:

OnAuthCookieResponse = cookieResponseDelegate;
TSharedRef<IHttpRequest> request = FHttpModule::Get().CreateRequest();
FString url = NewObject<UURLBuilder>()

request->OnProcessRequestComplete().BindUObject(this, &UAClass::ReceivedAuth);

The stack trace points me to line 559 in CurlHttp.cpp. IsURLEncoded() returns false which causes the check() to fail.

check(!GetHeader("Content-Type").IsEmpty() || IsURLEncoded(RequestPayload));

However when the engine passes data here, IsURLEncoded() returns true and the check() passes. Here is a sample of some data from the engine that passes. You can see it is a JSON string. enter image description here

Here is what my data looks like that causes the engine to crash enter image description here

You can see they are both JSON strings but mine causes the check to fail. I have also tried to completely URL encode the JSON string and the check still fails.

So why does this fail for me but passes when used by the engine?


{ and } are not valid URL characters, so your JSON is not URLEncoded. I bet the engine is sending a content type of application/json, which then bypasses the Url-Encoding check.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.