UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IHttpBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
8{
23
25 inline const TCHAR* ToString(EHttpRequestStatus::Type EnumVal)
26 {
27 switch (EnumVal)
28 {
29 case NotStarted:
30 {
31 return TEXT("NotStarted");
32 }
33 case Processing:
34 {
35 return TEXT("Processing");
36 }
37 case Failed:
38 {
39 return TEXT("Failed");
40 }
41 case Succeeded:
42 {
43 return TEXT("Succeeded");
44 }
45 }
46 return TEXT("");
47 }
48
50 {
51 return Value != NotStarted && Value != Processing;
52 }
53}
54
59{
60 None = 0,
63 // This acts differently than the platform timeout. It's the time out of the entire request including
64 // retries, which configured by the user. The platform timeout has different meanings/APIs on different
65 // platforms, such as resolve host timeout, connect timeout, send timeout, receive timeout, entire
66 // request timeout etc. It's not practical to unify to same behavior between them through their APIs.
67 // When user's configured time is up, it's TimedOut no matter which step this Http request is in.
69 Other
70};
71
74{
75 switch (HttpFailureReason)
76 {
77 case EHttpFailureReason::None: return TEXT("None");
78 case EHttpFailureReason::ConnectionError: return TEXT("ConnectionError");
79 case EHttpFailureReason::Cancelled: return TEXT("Cancelled");
80 case EHttpFailureReason::TimedOut: return TEXT("TimedOut");
81 case EHttpFailureReason::Other: return TEXT("Other");
82 default: checkNoEntry(); return TEXT("Invalid");
83 }
84}
85
90{
91public:
97 virtual const FString& GetURL() const = 0;
98
104 virtual const FString& GetEffectiveURL() const = 0;
105
112
119
128 virtual FString GetURLParameter(const FString& ParameterName) const = 0;
129
135 virtual FString GetHeader(const FString& HeaderName) const = 0;
136
142 virtual TArray<FString> GetAllHeaders() const = 0;
143
149 virtual FString GetContentType() const = 0;
150
157 virtual uint64 GetContentLength() const = 0;
158
164 virtual const TArray<uint8>& GetContent() const = 0;
165
169 virtual ~IHttpBase() = default;
170};
171
172#if !defined(UE_HTTP_CONNECTION_TIMEOUT_SUPPORT_RETRY)
173#define UE_HTTP_CONNECTION_TIMEOUT_SUPPORT_RETRY UE_DEPRECATED_MACRO(5.6, "UE_HTTP_CONNECTION_TIMEOUT_SUPPORT_RETRY has been deprecated because it is no longer necessary.") 1
174#endif
#define checkNoEntry()
Definition AssertionMacros.h:316
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const TCHAR * LexToString(EHttpFailureReason HttpFailureReason)
Definition IHttpBase.h:73
EHttpFailureReason
Definition IHttpBase.h:59
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition IHttpBase.h:90
virtual const FString & GetEffectiveURL() const =0
virtual FString GetContentType() const =0
virtual uint64 GetContentLength() const =0
virtual FString GetURLParameter(const FString &ParameterName) const =0
virtual const FString & GetURL() const =0
virtual TArray< FString > GetAllHeaders() const =0
virtual EHttpFailureReason GetFailureReason() const =0
virtual EHttpRequestStatus::Type GetStatus() const =0
virtual ~IHttpBase()=default
virtual const TArray< uint8 > & GetContent() const =0
virtual FString GetHeader(const FString &HeaderName) const =0
Definition Array.h:670
Definition IHttpBase.h:8
bool IsFinished(const EHttpRequestStatus::Type Value)
Definition IHttpBase.h:49
Type
Definition IHttpBase.h:13
@ Succeeded
Definition IHttpBase.h:21
@ Failed
Definition IHttpBase.h:19
@ NotStarted
Definition IHttpBase.h:15
@ Processing
Definition IHttpBase.h:17