-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored changes for json encoded put and post rest requests
- Loading branch information
1 parent
a6d6db7
commit cc913f0
Showing
6 changed files
with
157 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 0 additions & 124 deletions
124
...s/i5 Toolkit for Unity/Runtime/Utilities/Rest Connectors/GitHubWebRequestRestConnector.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...kit for Unity/Runtime/Utilities/Rest Connectors/JsonEncodeUnityWebRequestRestConnector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using i5.Toolkit.Core.Utilities.Async; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine.Networking; | ||
|
||
namespace i5.Toolkit.Core.Utilities | ||
{ | ||
public class JsonEncodeUnityWebRequestRestConnector : UnityWebRequestRestConnector | ||
{ | ||
public override async Task<WebResponse<string>> PostAsync(string uri, string postJson, Dictionary<string, string> headers = null) | ||
{ | ||
byte[] data = new UTF8Encoding().GetBytes(postJson); | ||
return await PostPutDataAsync(uri, "POST", data, "application/json", headers); | ||
} | ||
|
||
public override async Task<WebResponse<string>> PutAsync(string uri, string postData, Dictionary<string, string> headers = null) | ||
{ | ||
byte[] data = new UTF8Encoding().GetBytes(postData); | ||
return await PostPutDataAsync(uri, "PUT", data, "application/json", headers); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ors/GitHubWebRequestRestConnector.cs.meta → ...ncodeUnityWebRequestRestConnector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.