Why do I get syntax error: identifier FHttpRequestPtr

I’m trying to add HTTP requests to my game and everything compiles fine until I try to set up a delegate for when the response is ready. Adding this function causes the compiler to fail for syntax error identifier FHttpRequestPtr.

header

void OnSaveTokenResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);

cpp

void UGamejoltApi::OnSaveTokenResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{

}

I have both #include "Http.h" and #include "Interfaces/IHttpRequest.h". I also have this in my build file PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "HTTP" });.

Any help is greatly appreciated. I can’t make the game without the ability to make some HTTP requests.

The solution was to move the #import "Http.h" to the header file. Then it compiles fine.

I have the same problem, but moving/having #include "Http.h" in the .h header file didn’t fix the issue for me.

For anyone else looking now, make sure you aren’t using UFUNCTION for the function. Apparently that causes issues. If anyone knows why i’d love to understand!