Skip to content

Commit

Permalink
Update Utility.Http.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Rachel committed Oct 30, 2023
1 parent 69db1ff commit 1d56437
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static async UniTask<string> Get(string url, float timeout = 5f)
var cts = new CancellationTokenSource();
cts.CancelAfterSlim(TimeSpan.FromSeconds(timeout));

UnityWebRequest unityWebRequest = UnityWebRequest.Get(url);
using UnityWebRequest unityWebRequest = UnityWebRequest.Get(url);
return await SendWebRequest(unityWebRequest, cts);
}

Expand All @@ -41,7 +41,7 @@ public static async UniTask<string> Post(string url, string postData, float time
var cts = new CancellationTokenSource();
cts.CancelAfterSlim(TimeSpan.FromSeconds(timeout));

UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, postData);
using UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, postData);
return await SendWebRequest(unityWebRequest, cts);
}

Expand All @@ -57,7 +57,7 @@ public static async UniTask<string> Post(string url, Dictionary<string, string>
var cts = new CancellationTokenSource();
cts.CancelAfterSlim(TimeSpan.FromSeconds(timeout));

UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, formFields);
using UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, formFields);
return await SendWebRequest(unityWebRequest, cts);
}

Expand All @@ -73,7 +73,7 @@ public static async UniTask<string> Post(string url, WWWForm formData, float tim
var cts = new CancellationTokenSource();
cts.CancelAfterSlim(TimeSpan.FromSeconds(timeout));

UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, formData);
using UnityWebRequest unityWebRequest = UnityWebRequest.Post(url, formData);
return await SendWebRequest(unityWebRequest, cts);
}

Expand Down

0 comments on commit 1d56437

Please sign in to comment.