-
-
Save InternetCube/3d7ffea02e148badb02e9873db66c7c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool AExampleActor::Request() | |
| { | |
| const TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest(); | |
| HttpRequest->SetVerb(TEXT("GET")); | |
| HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/octet-stream")); | |
| HttpRequest->SetURL(/*何かしらの通信を行う先のURL*/); | |
| HttpRequest->OnProcessRequestComplete().BindUObject(this, &AExampleActor::OnReceived); | |
| return HttpRequest->ProcessRequest(); | |
| } | |
| void AExampleActor::OnReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccessful); | |
| { | |
| if (!Request.IsValid()) | |
| { | |
| if (OnFailure.IsBound()) | |
| { | |
| OnFailure.Broadcast(); | |
| } | |
| return; | |
| } | |
| if (!Response.IsValid()) | |
| { | |
| if (OnFailure.IsBound()) | |
| { | |
| OnFailure.Broadcast(); | |
| } | |
| return; | |
| } | |
| if (Response->GetResponseCode() != EHttpResponseCodes::Ok) | |
| { | |
| if (OnFailure.IsBound()) | |
| { | |
| OnFailure.Broadcast(); | |
| } | |
| return; | |
| } | |
| if (!bSuccessful) | |
| { | |
| if (OnFailure.IsBound()) | |
| { | |
| OnFailure.Broadcast(); | |
| } | |
| return; | |
| } | |
| // Request成功時の処理 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment