Hey Guys,
My application has a feature where you can download 3D assets from the web via a URL. To make the redemption process easier we made a shortcode system, with it we can add the provided shortcode to a static URL, this will then “redirect” to the full URL that has the file.
For example:
shortcode = ER2DEF
static URL = https://staticurl.com/
so above shortcode becomes https://staticurl.com/ER2DEF which redirects to the full URL with the file.
The issue however is that I actually want to retrieve the URL it has been redirected to, instead of the file itself (or both really if that’s possible)
Currently I make a httpRequest with the below code.
if (url.IsEmpty())
{
UE_LOG(LogTemp, Warning, TEXT("Url is empty!"));
return;
}
#if ENGINE_MINOR_VERSION > 25
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httpRequest = FHttpModule::Get().CreateRequest();
#else
TSharedRef<IHttpRequest> httpRequest = FHttpModule::Get().CreateRequest();
#endif
httpRequest->SetURL(url);
httpRequest->OnProcessRequestComplete().BindLambda([](FHttpRequestPtr request, FHttpResponsePtr response, bool bSuccess, FUrlHttpResponse Completed)
{
FString fullUrl;
if (bSuccess && response.IsValid())
{
fullUrl = response->GetContentAsString();
}
Completed.ExecuteIfBound(fullUrl);
}, completed);
httpRequest->ProcessRequest();
And it works fine however as mentioned I actually need to retrieve the URL it has been redirected to. Is it possible to do so?
So far I haven’t been able to find a way.
Thank you in advance