UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FHttpRequestAdapterBase Class Reference

#include <HttpRequestAdapter.h>

+ Inheritance diagram for FHttpRequestAdapterBase:

Public Member Functions

HTTP_API FHttpRequestAdapterBase (const TSharedRef< IHttpRequest > &InHttpRequest)
 
HTTP_API ~FHttpRequestAdapterBase ()
 
virtual HTTP_API const FString & GetURL () const override
 
virtual HTTP_API FString GetURLParameter (const FString &ParameterName) const override
 
virtual HTTP_API FString GetHeader (const FString &HeaderName) const override
 
virtual HTTP_API TArray< FString > GetAllHeaders () const override
 
virtual HTTP_API FString GetContentType () const override
 
virtual HTTP_API uint64 GetContentLength () const override
 
virtual HTTP_API const TArray< uint8 > & GetContent () const override
 
virtual HTTP_API FString GetVerb () const override
 
virtual HTTP_API FString GetOption (const FName Option) const override
 
virtual HTTP_API void SetVerb (const FString &Verb) override
 
virtual HTTP_API void SetURL (const FString &URL) override
 
virtual HTTP_API void SetOption (const FName Option, const FString &OptionValue) override
 
virtual HTTP_API void SetContent (const TArray< uint8 > &ContentPayload) override
 
virtual HTTP_API void SetContent (TArray< uint8 > &&ContentPayload) override
 
virtual HTTP_API void SetContentAsString (const FString &ContentString) override
 
virtual HTTP_API bool SetContentAsStreamedFile (const FString &Filename) override
 
virtual HTTP_API bool SetContentFromStream (TSharedRef< FArchive, ESPMode::ThreadSafe > Stream) override
 
virtual HTTP_API bool SetResponseBodyReceiveStream (TSharedRef< FArchive > Stream) override
 
virtual HTTP_API void SetHeader (const FString &HeaderName, const FString &HeaderValue) override
 
virtual HTTP_API void AppendToHeader (const FString &HeaderName, const FString &AdditionalHeaderValue) override
 
virtual HTTP_API void SetTimeout (float InTimeoutSecs) override
 
virtual HTTP_API void ClearTimeout () override
 
virtual HTTP_API void ResetTimeoutStatus () override
 
virtual HTTP_API TOptional< floatGetTimeout () const override
 
virtual HTTP_API void SetActivityTimeout (float InTimeoutSecs) override
 
virtual HTTP_API void ProcessRequestUntilComplete () override
 
virtual HTTP_API const FHttpResponsePtr GetResponse () const override
 
virtual HTTP_API float GetElapsedTime () const override
 
virtual HTTP_API EHttpRequestStatus::Type GetStatus () const override
 
virtual HTTP_API EHttpFailureReason GetFailureReason () const override
 
virtual HTTP_API const FString & GetEffectiveURL () const override
 
virtual HTTP_API void Tick (float DeltaSeconds) override
 
virtual HTTP_API void SetDelegateThreadPolicy (EHttpRequestDelegateThreadPolicy InThreadPolicy) override
 
virtual HTTP_API EHttpRequestDelegateThreadPolicy GetDelegateThreadPolicy () const override
 
virtual HTTP_API void SetPriority (EHttpRequestPriority InPriority) override
 
virtual HTTP_API EHttpRequestPriority GetPriority () const override
 
- Public Member Functions inherited from FHttpRequestImpl
virtual HTTP_API FHttpRequestCompleteDelegateOnProcessRequestComplete () override
 
virtual HTTP_API FHttpRequestProgressDelegate64OnRequestProgress64 () override
 
virtual HTTP_API FHttpRequestStatusCodeReceivedDelegateOnStatusCodeReceived () override
 
virtual HTTP_API FHttpRequestHeaderReceivedDelegateOnHeaderReceived () override
 
virtual HTTP_API FHttpRequestWillRetryDelegateOnRequestWillRetry () override
 
virtual HTTP_API void Shutdown ()
 
- Public Member Functions inherited from IHttpRequest
HTTP_API bool SetResponseBodyReceiveStreamDelegateV2 (FHttpRequestStreamDelegateV2 StreamDelegate)
 
virtual bool ProcessRequest ()=0
 
virtual void CancelRequest ()=0
 
virtual ~IHttpRequest ()=default
 
- Public Member Functions inherited from IHttpBase
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
 

Protected Attributes

TSharedRef< IHttpRequestHttpRequest
 
- Protected Attributes inherited from FHttpRequestImpl
FHttpRequestCompleteDelegate RequestCompleteDelegate
 
FHttpRequestProgressDelegate64 RequestProgressDelegate64
 
FHttpRequestStatusCodeReceivedDelegate StatusCodeReceivedDelegate
 
FHttpRequestHeaderReceivedDelegate HeaderReceivedDelegate
 
FHttpRequestWillRetryDelegate OnRequestWillRetryDelegate
 

Additional Inherited Members

- Protected Member Functions inherited from FHttpRequestImpl
HTTP_API void BroadcastResponseHeadersReceived ()
 
- 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

Adapter class for IHttpRequest abstract interface does not fully expose the wrapped interface in the base. This allows client defined marshalling of the requests when end point permissions are at issue.

Constructor & Destructor Documentation

◆ FHttpRequestAdapterBase()

FHttpRequestAdapterBase::FHttpRequestAdapterBase ( const TSharedRef< IHttpRequest > &  InHttpRequest)

◆ ~FHttpRequestAdapterBase()

FHttpRequestAdapterBase::~FHttpRequestAdapterBase ( )
default

Member Function Documentation

◆ AppendToHeader()

void FHttpRequestAdapterBase::AppendToHeader ( const FString &  HeaderName,
const FString &  AdditionalHeaderValue 
)
overridevirtual

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

Implements IHttpRequest.

◆ ClearTimeout()

void FHttpRequestAdapterBase::ClearTimeout ( )
overridevirtual

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

Implements IHttpRequest.

◆ GetAllHeaders()

TArray< FString > FHttpRequestAdapterBase::GetAllHeaders ( ) const
overridevirtual

Return all headers in an array in "Name: Value" format.

Returns
the header array of strings

Implements IHttpBase.

◆ GetContent()

const TArray< uint8 > & FHttpRequestAdapterBase::GetContent ( ) const
overridevirtual

Get the content payload of the request or response.

Parameters
Content- array that will be filled with the content.

Implements IHttpBase.

◆ GetContentLength()

uint64 FHttpRequestAdapterBase::GetContentLength ( ) const
overridevirtual

Shortcut to get the Content-Length header value. Will not always return non-zero. If you want the real length of the payload, get the payload and check it's length.

Returns
the content length (if available)

Implements IHttpBase.

◆ GetContentType()

FString FHttpRequestAdapterBase::GetContentType ( ) const
overridevirtual

Shortcut to get the Content-Type header value (if available)

Returns
the content type.

Implements IHttpBase.

◆ GetDelegateThreadPolicy()

EHttpRequestDelegateThreadPolicy FHttpRequestAdapterBase::GetDelegateThreadPolicy ( ) const
overridevirtual

Get thread policy about which thread to complete this request

Returns
The thread policy

Implements IHttpRequest.

◆ GetEffectiveURL()

const FString & FHttpRequestAdapterBase::GetEffectiveURL ( ) const
overridevirtual

Get the effective URL in case of redirected. If not redirected, it's the same as GetURL

Returns
the effective URL string.

Implements IHttpBase.

◆ GetElapsedTime()

float FHttpRequestAdapterBase::GetElapsedTime ( ) const
overridevirtual

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

Returns
elapsed time in seconds.

Implements IHttpRequest.

◆ GetFailureReason()

EHttpFailureReason FHttpRequestAdapterBase::GetFailureReason ( ) const
overridevirtual

Get the reason of th failure if GetStatus returns Failed

Returns
the reason of the failure

Implements IHttpBase.

◆ GetHeader()

FString FHttpRequestAdapterBase::GetHeader ( const FString &  HeaderName) const
overridevirtual

Gets the value of a header, or empty string if not found.

Parameters
HeaderName- name of the header to set.

Implements IHttpBase.

◆ GetOption()

FString FHttpRequestAdapterBase::GetOption ( const FName  Option) const
overridevirtual

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

Implements IHttpRequest.

◆ GetPriority()

EHttpRequestPriority FHttpRequestAdapterBase::GetPriority ( ) const
overridevirtual

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

Returns
The request priority

Implements IHttpRequest.

◆ GetResponse()

const FHttpResponsePtr FHttpRequestAdapterBase::GetResponse ( ) const
overridevirtual

Get the associated Response

Returns
the response

Implements IHttpRequest.

◆ GetStatus()

EHttpRequestStatus::Type FHttpRequestAdapterBase::GetStatus ( ) const
overridevirtual

Get the current status of the request being processed

Returns
the current status

Implements IHttpBase.

◆ GetTimeout()

TOptional< float > FHttpRequestAdapterBase::GetTimeout ( ) const
overridevirtual

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

Implements IHttpRequest.

◆ GetURL()

const FString & FHttpRequestAdapterBase::GetURL ( ) const
overridevirtual

Get the URL used to send the request.

Returns
the URL string.

Implements IHttpBase.

◆ GetURLParameter()

FString FHttpRequestAdapterBase::GetURLParameter ( const FString &  ParameterName) const
overridevirtual

Gets an URL parameter. expected format is ?Key=Value&Key=Value... If that format is not used, this function will not work.

Parameters
ParameterName- the parameter to request.
Returns
the parameter value string.

Implements IHttpBase.

◆ GetVerb()

FString FHttpRequestAdapterBase::GetVerb ( ) const
overridevirtual

Gets the verb (GET, PUT, POST) used by the request.

Returns
the verb string

Implements IHttpRequest.

◆ ProcessRequestUntilComplete()

void FHttpRequestAdapterBase::ProcessRequestUntilComplete ( )
overridevirtual

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

Implements IHttpRequest.

◆ ResetTimeoutStatus()

void FHttpRequestAdapterBase::ResetTimeoutStatus ( )
overridevirtual

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

Implements IHttpRequest.

◆ SetActivityTimeout()

void FHttpRequestAdapterBase::SetActivityTimeout ( float  InTimeoutSecs)
overridevirtual

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

Implements IHttpRequest.

◆ SetContent() [1/2]

void FHttpRequestAdapterBase::SetContent ( const TArray< uint8 > &  ContentPayload)
overridevirtual

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

Parameters
ContentPayload- payload to set.

Implements IHttpRequest.

◆ SetContent() [2/2]

void FHttpRequestAdapterBase::SetContent ( TArray< uint8 > &&  ContentPayload)
overridevirtual

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.

Implements IHttpRequest.

◆ SetContentAsStreamedFile()

bool FHttpRequestAdapterBase::SetContentAsStreamedFile ( const FString &  Filename)
overridevirtual

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.

Implements IHttpRequest.

◆ SetContentAsString()

void FHttpRequestAdapterBase::SetContentAsString ( const FString &  ContentString)
overridevirtual

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

Parameters
ContentString- payload to set.

Implements IHttpRequest.

◆ SetContentFromStream()

bool FHttpRequestAdapterBase::SetContentFromStream ( TSharedRef< FArchive, ESPMode::ThreadSafe Stream)
overridevirtual

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.

Implements IHttpRequest.

◆ SetDelegateThreadPolicy()

void FHttpRequestAdapterBase::SetDelegateThreadPolicy ( EHttpRequestDelegateThreadPolicy  InThreadPolicy)
overridevirtual

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

Implements IHttpRequest.

◆ SetHeader()

void FHttpRequestAdapterBase::SetHeader ( const FString &  HeaderName,
const FString &  HeaderValue 
)
overridevirtual

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

Implements IHttpRequest.

◆ SetOption()

void FHttpRequestAdapterBase::SetOption ( const FName  Option,
const FString &  OptionValue 
)
overridevirtual

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

Implements IHttpRequest.

◆ SetPriority()

void FHttpRequestAdapterBase::SetPriority ( EHttpRequestPriority  InPriority)
overridevirtual

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

Implements IHttpRequest.

◆ SetResponseBodyReceiveStream()

bool FHttpRequestAdapterBase::SetResponseBodyReceiveStream ( TSharedRef< FArchive Stream)
overridevirtual

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.

Implements IHttpRequest.

◆ SetTimeout()

void FHttpRequestAdapterBase::SetTimeout ( float  InTimeoutSecs)
overridevirtual

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

Implements IHttpRequest.

◆ SetURL()

void FHttpRequestAdapterBase::SetURL ( const FString &  URL)
overridevirtual

Sets the URL for the request Eg. (http://my.domain.com/something.ext?key=value&key2=value). Must be set before calling ProcessRequest.

Parameters
URL- URL to use.

Implements IHttpRequest.

◆ SetVerb()

void FHttpRequestAdapterBase::SetVerb ( const FString &  Verb)
overridevirtual

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.

Implements IHttpRequest.

◆ Tick()

void FHttpRequestAdapterBase::Tick ( float  DeltaSeconds)
overridevirtual

Used to tick the request

Parameters
DeltaSeconds- seconds since last ticked

Implements IHttpRequest.

Member Data Documentation

◆ HttpRequest

TSharedRef<IHttpRequest> FHttpRequestAdapterBase::HttpRequest
protected

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