-
Notifications
You must be signed in to change notification settings - Fork 309
Added custom header support (such as Auth, User-agent, Connection) #381
base: develop
Are you sure you want to change the base?
Conversation
@@ -30,7 +30,7 @@ void UVaRestSubsystem::Deinitialize() | |||
Super::Deinitialize(); | |||
} | |||
|
|||
void UVaRestSubsystem::CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback) | |||
void UVaRestSubsystem::CallURL(const FString& URL, EVaRestRequestVerb Verb, TMap<FString, FString> headers, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a const reference since it's not being modified.
for (const TPair<FString, FString>& pair : headers) | ||
Request->SetHeader(pair.Key, pair.Value); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add {} to match the rest of the code?
@@ -15,10 +15,11 @@ DECLARE_DYNAMIC_DELEGATE_OneParam(FVaRestCallDelegate, UVaRestRequestJSON*, Requ | |||
USTRUCT() | |||
struct FVaRestCallResponse | |||
{ | |||
GENERATED_BODY() | |||
GENERATED_USTRUCT_BODY() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be GENERATED_BODY
as GENERATED_USTRUCT_BODY
is old and deprecated.
@@ -51,7 +52,7 @@ class VAREST_API UVaRestSubsystem : public UEngineSubsystem | |||
public: | |||
/** Easy way to process http requests */ | |||
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility") | |||
void CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback); | |||
void CallURL(const FString& URL, EVaRestRequestVerb Verb, TMap<FString, FString> headers, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ref
Thanks you for your comment. |
just updated |
@@ -30,7 +30,7 @@ void UVaRestSubsystem::Deinitialize() | |||
Super::Deinitialize(); | |||
} | |||
|
|||
void UVaRestSubsystem::CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback) | |||
void UVaRestSubsystem::CallURL(const FString& URL, EVaRestRequestVerb Verb, const TMap<FString, FString> headers, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the headers tmap a const ref?
@@ -51,7 +52,7 @@ class VAREST_API UVaRestSubsystem : public UEngineSubsystem | |||
public: | |||
/** Easy way to process http requests */ | |||
UFUNCTION(BlueprintCallable, Category = "VaRest|Utility") | |||
void CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback); | |||
void CallURL(const FString& URL, EVaRestRequestVerb Verb, const TMap<FString, FString> headers, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tmap as const ref
No description provided.