UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGenericPlatformHttpRequest Class Reference
+ Inheritance diagram for FGenericPlatformHttpRequest:

Public Member Functions

virtual const FString & GetURL () const override
 
virtual FString GetURLParameter (const FString &ParameterName) const override
 
virtual FString GetHeader (const FString &HeaderName) const override
 
virtual TArray< FString > GetAllHeaders () const override
 
virtual FString GetContentType () const override
 
virtual uint64 GetContentLength () const override
 
virtual const TArray< uint8 > & GetContent () const override
 
virtual FString GetVerb () const override
 
virtual void SetVerb (const FString &Verb) override
 
virtual void SetURL (const FString &InURL) override
 
virtual FString GetOption (const FName Option) const override
 
virtual void SetOption (const FName Option, const FString &OptionValue) override
 
virtual void SetContent (const TArray< uint8 > &ContentPayload) override
 
virtual void SetContent (TArray< uint8 > &&ContentPayload) override
 
virtual void SetContentAsString (const FString &ContentString) override
 
virtual bool SetContentAsStreamedFile (const FString &Filename) override
 
virtual bool SetContentFromStream (TSharedRef< FArchive, ESPMode::ThreadSafe > Stream) override
 
virtual bool SetResponseBodyReceiveStream (TSharedRef< FArchive > Stream) override
 
virtual void SetHeader (const FString &HeaderName, const FString &HeaderValue) override
 
virtual void AppendToHeader (const FString &HeaderName, const FString &AdditionalHeaderValue) override
 
virtual bool ProcessRequest () override
 
virtual void CancelRequest () override
 
virtual EHttpRequestStatus::Type GetStatus () const override
 
virtual EHttpFailureReason GetFailureReason () const override
 
virtual const FString & GetEffectiveURL () const override
 
virtual const FHttpResponsePtr GetResponse () const override
 
virtual void Tick (float DeltaSeconds) override
 
virtual float GetElapsedTime () const override
 
virtual void SetDelegateThreadPolicy (EHttpRequestDelegateThreadPolicy InDelegateThreadPolicy) override
 
virtual EHttpRequestDelegateThreadPolicy GetDelegateThreadPolicy () const override
 
virtual HTTP_API void SetPriority (EHttpRequestPriority InPriority) override
 
virtual HTTP_API EHttpRequestPriority GetPriority () const override
 
virtual void SetTimeout (float InTimeoutSecs) override
 
virtual void ClearTimeout () override
 
virtual void ResetTimeoutStatus () override
 
virtual TOptional< floatGetTimeout () const override
 
virtual void SetActivityTimeout (float InTimeoutSecs) override
 
virtual void ProcessRequestUntilComplete () 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 ~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
 

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)
 
- Protected Attributes inherited from FHttpRequestImpl
FHttpRequestCompleteDelegate RequestCompleteDelegate
 
FHttpRequestProgressDelegate64 RequestProgressDelegate64
 
FHttpRequestStatusCodeReceivedDelegate StatusCodeReceivedDelegate
 
FHttpRequestHeaderReceivedDelegate HeaderReceivedDelegate
 
FHttpRequestWillRetryDelegate OnRequestWillRetryDelegate
 

Detailed Description

A generic http request

Member Function Documentation

◆ AppendToHeader()

virtual void FGenericPlatformHttpRequest::AppendToHeader ( const FString &  HeaderName,
const FString &  AdditionalHeaderValue 
)
inlineoverridevirtual

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.

◆ CancelRequest()

virtual void FGenericPlatformHttpRequest::CancelRequest ( )
inlineoverridevirtual

Called to cancel a request that is still being processed

Implements IHttpRequest.

◆ ClearTimeout()

virtual void FGenericPlatformHttpRequest::ClearTimeout ( )
inlineoverridevirtual

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

Implements IHttpRequest.

◆ GetAllHeaders()

virtual TArray< FString > FGenericPlatformHttpRequest::GetAllHeaders ( ) const
inlineoverridevirtual

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

Returns
the header array of strings

Implements IHttpBase.

◆ GetContent()

virtual const TArray< uint8 > & FGenericPlatformHttpRequest::GetContent ( ) const
inlineoverridevirtual

Get the content payload of the request or response.

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

Implements IHttpBase.

◆ GetContentLength()

virtual uint64 FGenericPlatformHttpRequest::GetContentLength ( ) const
inlineoverridevirtual

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()

virtual FString FGenericPlatformHttpRequest::GetContentType ( ) const
inlineoverridevirtual

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

Returns
the content type.

Implements IHttpBase.

◆ GetDelegateThreadPolicy()

virtual EHttpRequestDelegateThreadPolicy FGenericPlatformHttpRequest::GetDelegateThreadPolicy ( ) const
inlineoverridevirtual

Get thread policy about which thread to complete this request

Returns
The thread policy

Implements IHttpRequest.

◆ GetEffectiveURL()

virtual const FString & FGenericPlatformHttpRequest::GetEffectiveURL ( ) const
inlineoverridevirtual

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()

virtual float FGenericPlatformHttpRequest::GetElapsedTime ( ) const
inlineoverridevirtual

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

Returns
elapsed time in seconds.

Implements IHttpRequest.

◆ GetFailureReason()

virtual EHttpFailureReason FGenericPlatformHttpRequest::GetFailureReason ( ) const
inlineoverridevirtual

Get the reason of th failure if GetStatus returns Failed

Returns
the reason of the failure

Implements IHttpBase.

◆ GetHeader()

virtual FString FGenericPlatformHttpRequest::GetHeader ( const FString &  HeaderName) const
inlineoverridevirtual

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

Parameters
HeaderName- name of the header to set.

Implements IHttpBase.

◆ GetOption()

virtual FString FGenericPlatformHttpRequest::GetOption ( const FName  Option) const
inlineoverridevirtual

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()

virtual HTTP_API EHttpRequestPriority FGenericPlatformHttpRequest::GetPriority ( ) const
inlineoverridevirtual

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()

virtual const FHttpResponsePtr FGenericPlatformHttpRequest::GetResponse ( ) const
inlineoverridevirtual

Get the associated Response

Returns
the response

Implements IHttpRequest.

◆ GetStatus()

virtual EHttpRequestStatus::Type FGenericPlatformHttpRequest::GetStatus ( ) const
inlineoverridevirtual

Get the current status of the request being processed

Returns
the current status

Implements IHttpBase.

◆ GetTimeout()

virtual TOptional< float > FGenericPlatformHttpRequest::GetTimeout ( ) const
inlineoverridevirtual

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()

virtual const FString & FGenericPlatformHttpRequest::GetURL ( ) const
inlineoverridevirtual

Get the URL used to send the request.

Returns
the URL string.

Implements IHttpBase.

◆ GetURLParameter()

virtual FString FGenericPlatformHttpRequest::GetURLParameter ( const FString &  ParameterName) const
inlineoverridevirtual

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()

virtual FString FGenericPlatformHttpRequest::GetVerb ( ) const
inlineoverridevirtual

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

Returns
the verb string

Implements IHttpRequest.

◆ ProcessRequest()

virtual bool FGenericPlatformHttpRequest::ProcessRequest ( )
inlineoverridevirtual

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.

Implements IHttpRequest.

◆ ProcessRequestUntilComplete()

virtual void FGenericPlatformHttpRequest::ProcessRequestUntilComplete ( )
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::ResetTimeoutStatus ( )
inlineoverridevirtual

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

Implements IHttpRequest.

◆ SetActivityTimeout()

virtual void FGenericPlatformHttpRequest::SetActivityTimeout ( float  InTimeoutSecs)
inlineoverridevirtual

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]

virtual void FGenericPlatformHttpRequest::SetContent ( const TArray< uint8 > &  ContentPayload)
inlineoverridevirtual

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

Parameters
ContentPayload- payload to set.

Implements IHttpRequest.

◆ SetContent() [2/2]

virtual void FGenericPlatformHttpRequest::SetContent ( TArray< uint8 > &&  ContentPayload)
inlineoverridevirtual

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()

virtual bool FGenericPlatformHttpRequest::SetContentAsStreamedFile ( const FString &  Filename)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetContentAsString ( const FString &  ContentString)
inlineoverridevirtual

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

Parameters
ContentString- payload to set.

Implements IHttpRequest.

◆ SetContentFromStream()

virtual bool FGenericPlatformHttpRequest::SetContentFromStream ( TSharedRef< FArchive, ESPMode::ThreadSafe Stream)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetDelegateThreadPolicy ( EHttpRequestDelegateThreadPolicy  InThreadPolicy)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetHeader ( const FString &  HeaderName,
const FString &  HeaderValue 
)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetOption ( const FName  Option,
const FString &  OptionValue 
)
inlineoverridevirtual

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()

virtual HTTP_API void FGenericPlatformHttpRequest::SetPriority ( EHttpRequestPriority  InPriority)
inlineoverridevirtual

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()

virtual bool FGenericPlatformHttpRequest::SetResponseBodyReceiveStream ( TSharedRef< FArchive Stream)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetTimeout ( float  InTimeoutSecs)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetURL ( const FString &  URL)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::SetVerb ( const FString &  Verb)
inlineoverridevirtual

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()

virtual void FGenericPlatformHttpRequest::Tick ( float  DeltaSeconds)
inlineoverridevirtual

Used to tick the request

Parameters
DeltaSeconds- seconds since last ticked

Implements IHttpRequest.


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