Lesson 60 - Making an HTTP Request

This commit is contained in:
Norman Lansing
2026-03-29 20:20:59 -04:00
parent 62243acf46
commit 1e5885ac26
4 changed files with 48 additions and 22 deletions

View File

@@ -119,7 +119,8 @@
<list default="true" id="91dd7ef3-692f-484d-9bd1-060b29650efd" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.FPSTemplate.dir/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.FPSTemplate.dir/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/DedicatedServers/DedicatedServers.build.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Source/DedicatedServers/DedicatedServers.build.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/DedicatedServers/Public/UI/HTTP/HTTPRequestManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/DedicatedServers/Public/UI/HTTP/HTTPRequestManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/DedicatedServers/Private/UI/APITest/APITestManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/DedicatedServers/Private/UI/APITest/APITestManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/DedicatedServers/Public/UI/APITest/APITestManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/DedicatedServers/Public/UI/APITest/APITestManager.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -138,6 +139,7 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="cidr-memory-view://0" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Source/DedicatedServers/DedicatedServers.Build.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Source/DedicatedServers/Private/Data/API/APIData.cpp" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Source/DedicatedServers/Private/Game/DS_GameMode.cpp" root0="FORCE_HIGHLIGHTING" />
@@ -177,25 +179,25 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
&quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
&quot;Uproject.FPSTemplate.executor&quot;: &quot;Run&quot;,
&quot;git-widget-placeholder&quot;: &quot;new/API__Gateway__v2&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;ml.llm.AcpAgentsConfigurable&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.MCP Project settings loaded": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
"Uproject.FPSTemplate.executor": "Debug",
"git-widget-placeholder": "new/API__Gateway__v2",
"ignore.virus.scanning.warn.message": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "ml.llm.AcpAgentsConfigurable",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RunManager" selected="Uproject.FPSTemplate">
<configuration name="UnrealAndroidFileTool: UAFT-linux-x64" type="DotNetMsBuildPublish" factoryName="Publish to IIS">
<riderPublish publish_profile="UAFT-linux-x64.pubxml" pubxml_path="$PROJECT_DIR$/../../UE_5_7_3/Engine/Source/Programs/UnrealAndroidFileTool/Properties/PublishProfiles/UAFT-linux-x64.pubxml" uuid_high="7955553615007426355" uuid_low="1901880150328835101" />
@@ -64925,7 +64927,7 @@
<workItem from="1774233517830" duration="18186000" />
<workItem from="1774317832300" duration="32871000" />
<workItem from="1774531822750" duration="19882000" />
<workItem from="1774817723065" duration="6192000" />
<workItem from="1774817723065" duration="8009000" />
</task>
<task id="LOCAL-00001" summary="Added in EC2 support and adjusted Anywhere if statement to allow EC2 and to clean uip variable placement.">
<option name="closed" value="true" />

View File

@@ -13,7 +13,8 @@ public class DedicatedServers : ModuleRules
"CoreUObject",
"Engine",
"OpenSSL",
"GameplayTags"
"GameplayTags",
"HTTP"
});
PrivateDependencyModuleNames.AddRange(new string[]

View File

@@ -2,8 +2,28 @@
#include "UI/APITest/APITestManager.h"
#include "HttpModule.h"
#include "Data/API/APIData.h"
#include "GameplayTags/DedicatedServerTags.h"
void UAPITestManager::ListFleetsButtonClicked()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "List Fleets Button Clicked");
check(APIData);
TSharedPtr<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &UAPITestManager::ListFleets_Response);
const FString APIUrl = APIData->GetAPIEndPoint(DedicatedServersTags::GameSessionsAPI::ListFleets);
Request->SetURL(APIUrl);
Request->SetVerb("GET");
Request->SetHeader("Content-Type", "application/json");
Request->ProcessRequest();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "List Fleets Request Made");
}
void UAPITestManager::ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "List Fleets Response Received");
}

View File

@@ -3,6 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Interfaces/IHttpRequest.h"
#include "UI/HTTP/HTTPRequestManager.h"
#include "APITestManager.generated.h"
@@ -18,4 +19,6 @@ public:
UFUNCTION()
void ListFleetsButtonClicked();
void ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
};