I am using the FHttpModule to communicate with a remote service. The payload is json and the remote service requires http basic authentication. The communication works fine in the editor and windows deployment, but does not work when deployed to HTML5.
Upon inspecting the request, I found that the header values were not being set. The Authorization header was absent and the content-type was set to application/x-www-form-urlencoded; charset=UTF-8.
The request code is pretty straight forward:
TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest(); HttpRequest->SetVerb(TEXT("POST")); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json")); HttpRequest->SetHeader(TEXT("Authorization"), AuthString); HttpRequest->SetContentAsString(Payload); HttpRequest->ProcessRequest();
The remote service has a different host name than the one hosting the game files, but it can handle CORS. When I use the browser to manually change the content-type and add the Authorization header, the browser correctly negotiates the CORS preflight.
Is there something that I am doing (or not doing) to cause the headers to be overwritten?
Edit: Forgot to mention that I am using version 4.7.3.