diff --git a/addons/com.heroiclabs.nakama/dotnet-utils/GodotHttpAdapter.cs b/addons/com.heroiclabs.nakama/dotnet-utils/GodotHttpAdapter.cs index 873cdcf..74a157c 100644 --- a/addons/com.heroiclabs.nakama/dotnet-utils/GodotHttpAdapter.cs +++ b/addons/com.heroiclabs.nakama/dotnet-utils/GodotHttpAdapter.cs @@ -22,7 +22,7 @@ namespace Nakama { /// - /// An HTTP adapter which uses Godot's HTTPRequest node. + /// An Http adapter which uses Godot's HttpRequest node. /// /// /// Note Content-Type header is always set as 'application/json'. @@ -39,25 +39,25 @@ public partial class GodotHttpAdapter : Node, IHttpAdapter { public async Task SendAsync(string method, Uri uri, IDictionary headers, byte[] body, int timeout, CancellationToken? cancellationToken) { - var req = new HTTPRequest(); + var req = new HttpRequest(); req.Timeout = timeout; if (OS.GetName() != "HTML5") { req.UseThreads = true; } - var godot_method = HTTPClient.Method.Get; + var godot_method = HttpClient.Method.Get; if (method == "POST") { - godot_method = HTTPClient.Method.Post; + godot_method = HttpClient.Method.Post; } else if (method == "PUT") { - godot_method = HTTPClient.Method.Put; + godot_method = HttpClient.Method.Put; } else if (method == "DELETE") { - godot_method = HTTPClient.Method.Delete; + godot_method = HttpClient.Method.Delete; } else if (method == "HEAD") { - godot_method = HTTPClient.Method.Head; + godot_method = HttpClient.Method.Head; } var headers_array = new String[headers.Count + 1]; @@ -71,13 +71,13 @@ public async Task SendAsync(string method, Uri uri, IDictionary SendAsync(string method, Uri uri, IDictionary= 200 && response_code <= 299) { + if (result == HttpRequest.Result.Success && response_code >= 200 && response_code <= 299) { return response_body; }