Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Finish v1.1-r12
Browse files Browse the repository at this point in the history
  • Loading branch information
ufna committed Dec 5, 2015
2 parents f9f7f2d + ec63d34 commit 9bd29c8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Key features:

Check the [Wiki](https://github.com/ufna/VaRest/wiki) tab for plugin usage examples and installation notes.

Current version: **1.1 R 11** (UE 4.8-4.10)
Current version: **1.1 R 12** (UE 4.8-4.10)

![SCREENSHOT](SCREENSHOT.jpg)

Expand Down
2 changes: 1 addition & 1 deletion Source/VaRestEditorPlugin/Private/VaRest_BreakJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class FKCHandler_BreakJson : public FNodeHandlingFunctor

void RegisterOutputTerm(FKismetFunctionContext& Context, UEdGraphPin* OutputPin, FBPTerminal* ContextTerm)
{
FBPTerminal *Term = Context.CreateLocalTerminalFromPinAutoChooseScope(OutputPin, OutputPin->PinName);
FBPTerminal *Term = Context.CreateLocalTerminalFromPinAutoChooseScope(OutputPin, Context.NetNameMap->MakeValidName(OutputPin));
Context.NetMap.Add(OutputPin, Term);
}

Expand Down
3 changes: 2 additions & 1 deletion Source/VaRestPlugin/Classes/Json/VaRestRequestJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ namespace ERequestContentType
{
enum Type
{
x_www_form_urlencoded,
x_www_form_urlencoded_url UMETA(DisplayName = "x-www-form-urlencoded (URL)"),
x_www_form_urlencoded_body UMETA(DisplayName = "x-www-form-urlencoded (Request Body)"),
json,
binary
};
Expand Down
33 changes: 30 additions & 3 deletions Source/VaRestPlugin/Private/Json/VaRestRequestJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ UVaRestRequestJSON::UVaRestRequestJSON(const class FObjectInitializer& PCIP)
BinaryContentType(TEXT("application/octet-stream"))
{
RequestVerb = ERequestVerb::GET;
RequestContentType = ERequestContentType::x_www_form_urlencoded;
RequestContentType = ERequestContentType::x_www_form_urlencoded_url;

ResetData();
}
Expand Down Expand Up @@ -261,7 +261,7 @@ void UVaRestRequestJSON::ProcessRequest(TSharedRef<IHttpRequest> HttpRequest)
// Set content-type
switch (RequestContentType)
{
case ERequestContentType::x_www_form_urlencoded:
case ERequestContentType::x_www_form_urlencoded_url:
{
HttpRequest->SetHeader("Content-Type", "application/x-www-form-urlencoded");

Expand All @@ -283,11 +283,38 @@ void UVaRestRequestJSON::ProcessRequest(TSharedRef<IHttpRequest> HttpRequest)
ParamIdx++;
}

// Apply params to the url
// Apply params
HttpRequest->SetURL(HttpRequest->GetURL() + UrlParams);

break;
}
case ERequestContentType::x_www_form_urlencoded_body:
{
HttpRequest->SetHeader("Content-Type", "application/x-www-form-urlencoded");

FString UrlParams = "";
uint16 ParamIdx = 0;

// Loop through all the values and prepare additional url part
for (auto RequestIt = RequestJsonObj->GetRootObject()->Values.CreateIterator(); RequestIt; ++RequestIt)
{
FString Key = RequestIt.Key();
FString Value = RequestIt.Value().Get()->AsString();

if (!Key.IsEmpty() && !Value.IsEmpty())
{
UrlParams += ParamIdx == 0 ? "" : "&";
UrlParams += UVaRestRequestJSON::PercentEncode(Key) + "=" + UVaRestRequestJSON::PercentEncode(Value);
}

ParamIdx++;
}

// Apply params
HttpRequest->SetContentAsString(UrlParams);

break;
}
case ERequestContentType::binary:
{
HttpRequest->SetHeader("Content-Type", BinaryContentType);
Expand Down
4 changes: 2 additions & 2 deletions VaRestPlugin.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"FileVersion" : 3,

"FriendlyName" : "VaRest",
"Version" : 11,
"VersionName" : "1.1-r11",
"Version" : 12,
"VersionName" : "1.1-r12",
"CreatedBy" : "Vladimir Alyamkin",
"CreatedByURL" : "http://alyamkin.com",
"EngineVersion" : 1579795,
Expand Down

0 comments on commit 9bd29c8

Please sign in to comment.