UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IHttpRequest Class Referenceabstract

#include <IHttpRequest.h>

+ Inheritance diagram for IHttpRequest:

Public Member Functions

virtual FString GetVerb () const =0
 
virtual void SetVerb (const FString &Verb)=0
 
virtual void SetURL (const FString &URL)=0
 
virtual FString GetOption (const FName Option) const =0
 
virtual void SetOption (const FName Option, const FString &OptionValue)=0
 
virtual void SetContent (const TArray< uint8 > &ContentPayload)=0
 
virtual void SetContent (TArray< uint8 > &&ContentPayload)=0
 
virtual void SetContentAsString (const FString &ContentString)=0
 
virtual bool SetContentAsStreamedFile (const FString &Filename)=0
 
virtual bool SetContentFromStream (TSharedRef< FArchive, ESPMode::ThreadSafe > Stream)=0
 
virtual bool SetResponseBodyReceiveStream (TSharedRef< FArchive > Stream)=0
 
HTTP_API bool SetResponseBodyReceiveStreamDelegateV2 (FHttpRequestStreamDelegateV2 StreamDelegate)
 
virtual void SetHeader (const FString &HeaderName, const FString &HeaderValue)=0
 
virtual void AppendToHeader (const FString &HeaderName, const FString &AdditionalHeaderValue)=0
 
virtual void SetTimeout (float InTimeoutSecs)=0
 
virtual void SetActivityTimeout (float InTimeoutSecs)=0
 
virtual void ClearTimeout ()=0
 
virtual void ResetTimeoutStatus ()=0
 
virtual TOptional< floatGetTimeout () const =0
 
virtual bool ProcessRequest ()=0
 
virtual FHttpRequestCompleteDelegateOnProcessRequestComplete ()=0
 
virtual FHttpRequestProgressDelegate64OnRequestProgress64 ()=0
 
virtual FHttpRequestWillRetryDelegateOnRequestWillRetry ()=0
 
virtual FHttpRequestHeaderReceivedDelegateOnHeaderReceived ()=0
 
virtual FHttpRequestStatusCodeReceivedDelegateOnStatusCodeReceived ()=0
 
virtual void CancelRequest ()=0
 
virtual const FHttpResponsePtr GetResponse () const =0
 
virtual void Tick (float DeltaSeconds)=0
 
virtual float GetElapsedTime () const =0
 
virtual void SetDelegateThreadPolicy (EHttpRequestDelegateThreadPolicy InThreadPolicy)=0
 
virtual EHttpRequestDelegateThreadPolicy GetDelegateThreadPolicy () const =0
 
virtual void ProcessRequestUntilComplete ()=0
 
virtual void SetPriority (EHttpRequestPriority InPriority)=0
 
virtual EHttpRequestPriority GetPriority () const =0
 
virtual ~IHttpRequest ()=default
 
- Public Member Functions inherited from IHttpBase
virtual const FString & GetURL () const =0
 
virtual const FString & GetEffectiveURL () const =0
 
virtual EHttpRequestStatus::Type GetStatus () const =0
 
virtual EHttpFailureReason GetFailureReason () const =0
 
virtual FString GetURLParameter (const FString &ParameterName) const =0
 
virtual FString GetHeader (const FString &HeaderName) const =0
 
virtual TArray< FString > GetAllHeaders () const =0
 
virtual FString GetContentType () const =0
 
virtual uint64 GetContentLength () const =0
 
virtual const TArray< uint8 > & GetContent () const =0
 
virtual ~IHttpBase ()=default
 
- Public Member Functions inherited from TSharedFromThis< IHttpRequest, ESPMode::ThreadSafe >
TSharedRef< IHttpRequest, Mode > AsShared ()
 
TSharedRef< IHttpRequest const, Mode > AsShared () const
 
TSharedRef< SubobjectType, Mode > AsSharedSubobject (SubobjectType *SubobjectPtr) const
 
TWeakPtr< IHttpRequest, Mode > AsWeak ()
 
TWeakPtr< IHttpRequest const, Mode > AsWeak () const
 
TWeakPtr< SubobjectType, Mode > AsWeakSubobject (SubobjectType *SubobjectPtr) const
 
void UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, SharedPtrMode > const *InSharedPtr, OtherType *InObject) const
 
void UpdateWeakReferenceInternal (TSharedRef< SharedRefType, SharedPtrMode > const *InSharedRef, OtherType *InObject) const
 
UE_FORCEINLINE_HINT bool DoesSharedInstanceExist () const
 

Additional Inherited Members

- Protected Member Functions inherited from TSharedFromThis< IHttpRequest, ESPMode::ThreadSafe >
 TSharedFromThis ()
 
 TSharedFromThis (TSharedFromThis const &)
 
UE_FORCEINLINE_HINT TSharedFromThisoperator= (TSharedFromThis const &)
 
 ~TSharedFromThis ()
 
- Static Protected Member Functions inherited from TSharedFromThis< IHttpRequest, ESPMode::ThreadSafe >
static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > SharedThis (OtherType *ThisPtr)
 
static UE_FORCEINLINE_HINT TSharedRef< OtherType const, Mode > SharedThis (const OtherType *ThisPtr)
 

Detailed Description

Interface for Http requests (created using FHttpFactory)

Constructor & Destructor Documentation

◆ ~IHttpRequest()

virtual IHttpRequest::~IHttpRequest ( )
virtualdefault

Destructor for overrides

Member Function Documentation

◆ AppendToHeader()

virtual void IHttpRequest::AppendToHeader ( const FString &  HeaderName,
const FString &  AdditionalHeaderValue 
)
pure virtual

Appends to the value already set in the header. If there is already content in that header, a comma delimiter is used. If the header is as of yet unset, the result is the same as calling SetHeader Content-Length is the only header set for you. Also see: SetHeader()

Parameters
HeaderName- Name of the header (ie, Content-Type)
AdditionalHeaderValue- Value to add to the existing contents of the specified header. comma is inserted between old value and new value, per HTTP specifications

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ CancelRequest()

virtual void IHttpRequest::CancelRequest ( )
pure virtual

◆ ClearTimeout()

virtual void IHttpRequest::ClearTimeout ( )
pure virtual

Clears the optional timeout in seconds for this HTTP request, causing the default value from FHttpModule::GetTimeout() to be used.

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetDelegateThreadPolicy()

virtual EHttpRequestDelegateThreadPolicy IHttpRequest::GetDelegateThreadPolicy ( ) const
pure virtual

Get thread policy about which thread to complete this request

Returns
The thread policy

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetElapsedTime()

virtual float IHttpRequest::GetElapsedTime ( ) const
pure virtual

Gets the time that it took for the server to fully respond to the request.

Returns
elapsed time in seconds.

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetOption()

virtual FString IHttpRequest::GetOption ( const FName  Option) const
pure virtual

Get the current value for the given option

Returns
the current value set for this option or an empty string if no value has been specified

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetPriority()

virtual EHttpRequestPriority IHttpRequest::GetPriority ( ) const
pure virtual

Get request priority, which is used to decide the position in the queue when max concurrent limit reached

Returns
The request priority

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetResponse()

virtual const FHttpResponsePtr IHttpRequest::GetResponse ( ) const
pure virtual

◆ GetTimeout()

virtual TOptional< float > IHttpRequest::GetTimeout ( ) const
pure virtual

Gets the optional timeout in seconds for this entire HTTP request to complete. If valid, this value overrides the default HTTP timeout set via FHttpModule::SetTimeout().

Returns
the timeout for this HTTP request instance, in seconds

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ GetVerb()

virtual FString IHttpRequest::GetVerb ( ) const
pure virtual

◆ OnHeaderReceived()

virtual FHttpRequestHeaderReceivedDelegate & IHttpRequest::OnHeaderReceived ( )
pure virtual

Delegate called to signal the receipt of a header. See FHttpRequestHeaderReceivedDelegate

Implemented in FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestImpl.

◆ OnProcessRequestComplete()

virtual FHttpRequestCompleteDelegate & IHttpRequest::OnProcessRequestComplete ( )
pure virtual

Delegate called when the request is complete. See FHttpRequestCompleteDelegate

Implemented in FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestImpl.

◆ OnRequestProgress64()

virtual FHttpRequestProgressDelegate64 & IHttpRequest::OnRequestProgress64 ( )
pure virtual

Delegate called to update the request/response progress. See FHttpRequestProgressDelegate64

Implemented in FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestImpl.

◆ OnRequestWillRetry()

virtual FHttpRequestWillRetryDelegate & IHttpRequest::OnRequestWillRetry ( )
pure virtual

Delegate called when the request will be retried

Implemented in FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestImpl.

◆ OnStatusCodeReceived()

virtual FHttpRequestStatusCodeReceivedDelegate & IHttpRequest::OnStatusCodeReceived ( )
pure virtual

Delegate called to signal the receipt of a header. See FHttpRequestStatusCodeReceivedDelegate

Implemented in FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestImpl.

◆ ProcessRequest()

virtual bool IHttpRequest::ProcessRequest ( )
pure virtual

Called to begin processing the request. OnProcessRequestComplete delegate is always called when the request completes or on error if it is bound. A request can be re-used but not while still being processed.

Returns
if the request was successfully started.

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRetrySystem::FRequest.

◆ ProcessRequestUntilComplete()

virtual void IHttpRequest::ProcessRequestUntilComplete ( )
pure virtual

Blocking call to wait the request until it's completed

WARNINGS:

  • This is a blocking call, DON'T use this in a time-sensitive context
  • Complete delegate will be used in this function so customized complete delegate is not supported
  • This will force the usage of EHttpRequestDelegateThreadPolicy::CompleteOnHttpThread to make sure the request can complete, when this function get called from main thread. So if any other delegate is bound, make sure the bound delegate can handle the custom logic in a thread-safe way

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ ResetTimeoutStatus()

virtual void IHttpRequest::ResetTimeoutStatus ( )
pure virtual

Reset the elapsed timeout duration and flag, after the request completed and need to be reused

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetActivityTimeout()

virtual void IHttpRequest::SetActivityTimeout ( float  InTimeoutSecs)
pure virtual

Sets an optional activity timeout in seconds for this HTTP request. After connecting to web server, if there is no activity(send or receive) happen for this time period, it will trigger activity timeout If set, this value overrides the default HTTP activity timeout

Parameters
InTimeoutSecs- Timeout for this HTTP request instance, in seconds

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetContent() [1/2]

virtual void IHttpRequest::SetContent ( const TArray< uint8 > &  ContentPayload)
pure virtual

Sets the content of the request (optional data). Usually only set for POST requests.

Parameters
ContentPayload- payload to set.

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest, FHttpRequestAdapterBase, and FTransactionallySafeHttpRequest::FClosedHttpRequest.

◆ SetContent() [2/2]

virtual void IHttpRequest::SetContent ( TArray< uint8 > &&  ContentPayload)
pure virtual

Sets the content of the request (optional data). Usually only set for POST requests.

This version lets the API take ownership of the payload directly, helpful for larger payloads.

Parameters
ContentPayload- payload to set.

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest, FHttpRequestAdapterBase, and FTransactionallySafeHttpRequest::FClosedHttpRequest.

◆ SetContentAsStreamedFile()

virtual bool IHttpRequest::SetContentAsStreamedFile ( const FString &  Filename)
pure virtual

Sets the content of the request to stream from a file.

Parameters
FileName- filename from which to stream the body.
Returns
True if the file is valid and will be used to stream the request. False otherwise.

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetContentAsString()

virtual void IHttpRequest::SetContentAsString ( const FString &  ContentString)
pure virtual

Sets the content of the request as a string encoded as UTF8.

Parameters
ContentString- payload to set.

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetContentFromStream()

virtual bool IHttpRequest::SetContentFromStream ( TSharedRef< FArchive, ESPMode::ThreadSafe Stream)
pure virtual

Sets the content of the request to stream directly from an archive. NOTE: The Stream->Serialize will be called from another thread other than the game thread

Parameters
Stream- archive from which the payload should be streamed.
Returns
True if the archive can be used to stream the request. False otherwise.

Implemented in FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetDelegateThreadPolicy()

virtual void IHttpRequest::SetDelegateThreadPolicy ( EHttpRequestDelegateThreadPolicy  InThreadPolicy)
pure virtual

Set thread policy about which thread to trigger the delegates, set by FHttpManager::SetRequestCompletedDelegate, IHttpRequest::OnStatusCodeReceived, IHttpRequest::OnHeaderReceived, IHttpRequest::OnRequestProgress64 and IHttpRequest::OnProcessRequestComplete.

Note that when set it as CompleteOnHttpThread, the thread to trigger delegates could be any thread depends on the implementation. User code should make the delegate thread-safe and shouldn't assume it's triggered by the thread where this request get created.

Parameters
InThreadPolicy- The thread policy to indicate which thread to trigger the delegates

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetHeader()

virtual void IHttpRequest::SetHeader ( const FString &  HeaderName,
const FString &  HeaderValue 
)
pure virtual

Sets optional header info. SetHeader for a given HeaderName will overwrite any previous values Use AppendToHeader to append more values for the same header Content-Length is the only header set for you. Required headers depends on the request itself. Eg. "multipart/form-data" needed for a form post

Parameters
HeaderName- Name of the header (ie, Content-Type)
HeaderValue- Value of the header

Implemented in FAppleHttpRequest, FGenericPlatformHttpRequest, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetOption()

virtual void IHttpRequest::SetOption ( const FName  Option,
const FString &  OptionValue 
)
pure virtual

Sets the given option for this Request Must be set before calling ProcessRequest.

Parameters
Option- The option to set, see 'HttpRequestOptions' for supported options
OptionValue- The value of the option to set

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetPriority()

virtual void IHttpRequest::SetPriority ( EHttpRequestPriority  InPriority)
pure virtual

Set priority of the request, which will be used to decide the position in the queue when max concurrent limit reached

Parameters
InHttpRequestPriority- The priority to set

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetResponseBodyReceiveStream()

virtual bool IHttpRequest::SetResponseBodyReceiveStream ( TSharedRef< FArchive Stream)
pure virtual

Sets the stream to receive the response body. Make sure to handle the cleanup of stream when Serialize generated error(Stream->GetError returns true after Stream->Serialize call), this http request will fail and quit.

NOTE: Once set, the data will no longer be cached in response, IHttpResponse::GetContent() and IHttpResponse::GetContentAsString() will return empty result. The Stream->Serialize will be called from another thread other than the game thread

Parameters
Stream- will be used to receive the response body
Returns
True if the stream can be used. False otherwise.

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetResponseBodyReceiveStreamDelegateV2()

bool IHttpRequest::SetResponseBodyReceiveStreamDelegateV2 ( FHttpRequestStreamDelegateV2  StreamDelegate)

Sets the delegate to receive the response body. Make sure to handle the cleanup of received data when failed to process the data(StreamDelegate return false), this http request will fail and quit.

NOTE: Once set, the data will no longer be cached in response, IHttpResponse::GetContent() and IHttpResponse::GetContentAsString() will return empty result. The delegate will be called from another thread other than the game thread

Parameters
StreamDelegate- will be used to receive the response body
Returns
True if the delegate can be used. False otherwise.

◆ SetTimeout()

virtual void IHttpRequest::SetTimeout ( float  InTimeoutSecs)
pure virtual

Sets an optional timeout in seconds for this entire HTTP request to complete. If set, this value overrides the default HTTP timeout set via FHttpModule::SetTimeout().

Parameters
InTimeoutSecs- Timeout for this HTTP request instance, in seconds

Implemented in FGenericPlatformHttpRequest, FHttpRequestCommon, FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, and FHttpRequestAdapterBase.

◆ SetURL()

virtual void IHttpRequest::SetURL ( const FString &  URL)
pure virtual

◆ SetVerb()

virtual void IHttpRequest::SetVerb ( const FString &  Verb)
pure virtual

Sets the verb used by the request. Eg. (GET, PUT, POST) Should be set before calling ProcessRequest. If not specified then a GET is assumed.

Parameters
Verb- verb to use.

Implemented in FNullHttpRequest, FTransactionallySafeHttpRequest::FClosedHttpRequest, FTransactionallySafeHttpRequest, FAppleHttpRequest, FGenericPlatformHttpRequest, and FHttpRequestAdapterBase.

◆ Tick()

virtual void IHttpRequest::Tick ( float  DeltaSeconds)
pure virtual

The documentation for this class was generated from the following files: