From 19335c66480881f578df3cd3b7d42f336319600c Mon Sep 17 00:00:00 2001 From: spaceyjase <429978+spaceyjase@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:48:47 +0100 Subject: [PATCH 1/3] Update http_request_class.rst Provides a working example that mirrors the gdscript code. --- tutorials/networking/http_request_class.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tutorials/networking/http_request_class.rst b/tutorials/networking/http_request_class.rst index 7a999ec9bf1..2b34401c9de 100644 --- a/tutorials/networking/http_request_class.rst +++ b/tutorials/networking/http_request_class.rst @@ -78,20 +78,22 @@ look for the ``name`` field and print that to console. .. code-tab:: csharp using Godot; + using System.Text; + using Godot.Collections; public partial class MyNode : Node { public override void _Ready() { - GetNode("HTTPRequest").RequestCompleted += OnRequestCompleted; HttpRequest httpRequest = GetNode("HTTPRequest"); + httpRequest.RequestCompleted += OnRequestCompleted; httpRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest"); } private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body) { - JsonParseResult json = Json.Parse(Encoding.UTF8.GetString(body)); - GD.Print(json.Result); + Dictionary d = Json.ParseString(Encoding.UTF8.GetString(body)).AsGodotDictionary(); + GD.Print(d["name"]); } } From 0a7de67764f1778d17989752b8e4ad97869bd785 Mon Sep 17 00:00:00 2001 From: spaceyjase <429978+spaceyjase@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:40:35 +0100 Subject: [PATCH 2/3] Update tutorials/networking/http_request_class.rst Co-authored-by: Raul Santos --- tutorials/networking/http_request_class.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/networking/http_request_class.rst b/tutorials/networking/http_request_class.rst index 2b34401c9de..6a95d197753 100644 --- a/tutorials/networking/http_request_class.rst +++ b/tutorials/networking/http_request_class.rst @@ -92,8 +92,8 @@ look for the ``name`` field and print that to console. private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body) { - Dictionary d = Json.ParseString(Encoding.UTF8.GetString(body)).AsGodotDictionary(); - GD.Print(d["name"]); + Godot.Collections.Dictionary json = Json.ParseString(Encoding.UTF8.GetString(body)).AsGodotDictionary(); + GD.Print(json["name"]); } } From fba27360e58f1dadd038a447771cfe5c64b94854 Mon Sep 17 00:00:00 2001 From: spaceyjase <429978+spaceyjase@users.noreply.github.com> Date: Fri, 7 Jul 2023 15:35:52 +0100 Subject: [PATCH 3/3] Update tutorials/networking/http_request_class.rst Co-authored-by: Raul Santos --- tutorials/networking/http_request_class.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/tutorials/networking/http_request_class.rst b/tutorials/networking/http_request_class.rst index 6a95d197753..283437b2fda 100644 --- a/tutorials/networking/http_request_class.rst +++ b/tutorials/networking/http_request_class.rst @@ -79,7 +79,6 @@ look for the ``name`` field and print that to console. using Godot; using System.Text; - using Godot.Collections; public partial class MyNode : Node {