I cannot test http in ue4. I have read some tutorial but I cannot reimplement them.
HttpTestGameMode.h:
UCLASS()
class PROGRAMMINGTUTORIAL_API AHttpTestGameMode : public AGameMode
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccessful);
private:
class FHttpModule* Http;
void SetHttpModule();
};
HttpTestGameMode.cpp:
#include "Http.h"
#include "HttpModule.h"
#include "IHttpRequest.h"
#include "IHttpBase.h"
#include "IHttpResponse.h"
...
Request->OnProcessRequestComplete().BindUObject(this, &AHttpTestGameMode::OnResponseReceived);
...
void AHttpTestGameMode::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccessful)
{
//TODO IMPLEMENT LATER
}
Error Message:
HttpTestGameMode.h(20): error C2061: syntax error: identifier 'FHttpRequestPtr'
HttpTestGameMode.h(20): error C2061: syntax error: identifier 'FHttpRequestPtr'
HttpTestGameMode.cpp(20): error C2664: 'void TBaseDelegate<TTypeWrapper<void>,FHttpRequestPtr,FHttpResponsePtr,bool>::BindUObject<AHttpTestGameMode,>(UserClass *,void (__cdecl AHttpTestGameMode::* )(FHttpRequestPtr,FHttpResponsePtr,bool) const)': cannot convert argument 2 from 'void (__cdecl AHttpTestGameMode::* )(void)' to 'void (__cdecl AHttpTestGameMode::* )(FHttpRequestPtr,FHttpResponsePtr,bool)'
Build.cs:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP" });