Lesson 61 - Parsing an HTTP Response

This commit is contained in:
Norman Lansing
2026-03-30 05:10:02 -04:00
parent 1e5885ac26
commit 6bf5d4cd0c
3 changed files with 46 additions and 22 deletions

View File

@@ -120,7 +120,6 @@
<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$/.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/DedicatedServers.build.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Source/DedicatedServers/DedicatedServers.build.cs" 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/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> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -179,25 +178,25 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ModuleVcsDetector.initialDetectionPerformed": "true", &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
"RunOnceActivity.MCP Project settings loaded": "true", &quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.git.unshallow": "true", &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
"RunOnceActivity.typescript.service.memoryLimit.init": "true", &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
"Uproject.FPSTemplate.executor": "Debug", &quot;Uproject.FPSTemplate.executor&quot;: &quot;Debug&quot;,
"git-widget-placeholder": "new/API__Gateway__v2", &quot;git-widget-placeholder&quot;: &quot;new/API__Gateway__v2&quot;,
"ignore.virus.scanning.warn.message": "true", &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"settings.editor.selected.configurable": "ml.llm.AcpAgentsConfigurable", &quot;settings.editor.selected.configurable&quot;: &quot;Debugger.ObjectiveC&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RunManager" selected="Uproject.FPSTemplate"> <component name="RunManager" selected="Uproject.FPSTemplate">
<configuration name="UnrealAndroidFileTool: UAFT-linux-x64" type="DotNetMsBuildPublish" factoryName="Publish to IIS"> <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" /> <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" />
@@ -64927,7 +64926,8 @@
<workItem from="1774233517830" duration="18186000" /> <workItem from="1774233517830" duration="18186000" />
<workItem from="1774317832300" duration="32871000" /> <workItem from="1774317832300" duration="32871000" />
<workItem from="1774531822750" duration="19882000" /> <workItem from="1774531822750" duration="19882000" />
<workItem from="1774817723065" duration="8009000" /> <workItem from="1774817723065" duration="15137000" />
<workItem from="1774837252595" duration="1068000" />
</task> </task>
<task id="LOCAL-00001" summary="Added in EC2 support and adjusted Anywhere if statement to allow EC2 and to clean uip variable placement."> <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" /> <option name="closed" value="true" />
@@ -64995,4 +64995,8 @@
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project> </project>

View File

@@ -21,7 +21,9 @@ public class DedicatedServers : ModuleRules
{ {
"Slate", "Slate",
"SlateCore", "SlateCore",
"UMG" "UMG",
"Json",
"JsonUtilities",
}); });
// Adds in the plugin for GameLiftServerSDK if it is the server build. // Adds in the plugin for GameLiftServerSDK if it is the server build.

View File

@@ -5,6 +5,8 @@
#include "HttpModule.h" #include "HttpModule.h"
#include "Data/API/APIData.h" #include "Data/API/APIData.h"
#include "GameplayTags/DedicatedServerTags.h" #include "GameplayTags/DedicatedServerTags.h"
#include "Interfaces/IHttpResponse.h"
void UAPITestManager::ListFleetsButtonClicked() void UAPITestManager::ListFleetsButtonClicked()
{ {
@@ -25,5 +27,21 @@ void UAPITestManager::ListFleetsButtonClicked()
void UAPITestManager::ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful) void UAPITestManager::ListFleets_Response(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{ {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "List Fleets Response Received"); GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "List Fleets Response Received");
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
if (FJsonSerializer::Deserialize(JsonReader, JsonObject))
{
if (JsonObject->HasField(TEXT("FleetIds")))
{
for (TSharedPtr<FJsonValue> Fleet : JsonObject->GetArrayField(TEXT("FleetIds")))
{
FString FleetString = Fleet->AsString();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FleetString);
}
}
}
} }