HttpReqActor.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "GameFramework/Actor.h"
  5. #include "Runtime/Online/HTTP/Public/Http.h"
  6. #include "HttpReqActor.generated.h"
  7. DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FResponseDelegate, FString, Response);
  8. UCLASS(ClassGroup = (HttpReq), meta = (BlueprintSpawnableComponent))
  9. class COMMUNICATION_ORG_API UHttpReqActor : public UActorComponent
  10. {
  11. GENERATED_BODY()
  12. public:
  13. // Sets default values for this actor's properties
  14. UHttpReqActor();
  15. protected:
  16. // Called when the game starts or when spawned
  17. virtual void BeginPlay() override;
  18. UPROPERTY(BlueprintAssignable)
  19. FResponseDelegate OnPostResponseReceived;
  20. FHttpModule* Http;
  21. /* The actual HTTP call */
  22. //UFUNCTION(BlueprintPure, Category = "HttpReq")
  23. UFUNCTION(BlueprintCallable, Category = "HttpReq")
  24. bool Post(FString URL,FString ContentString);
  25. /*Assign this function to call when the GET request processes sucessfully*/
  26. void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
  27. };