Skip to content

Commit 16c94c6

Browse files
Update http_request_class.rst (godotengine#7619)
Co-authored-by: Raul Santos <[email protected]>
1 parent 24980a5 commit 16c94c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tutorials/networking/http_request_class.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,21 @@ look for the ``name`` field and print that to console.
7878
.. code-tab:: csharp
7979

8080
using Godot;
81+
using System.Text;
8182

8283
public partial class MyNode : Node
8384
{
8485
public override void _Ready()
8586
{
86-
GetNode("HTTPRequest").RequestCompleted += OnRequestCompleted;
8787
HttpRequest httpRequest = GetNode<HttpRequest>("HTTPRequest");
88+
httpRequest.RequestCompleted += OnRequestCompleted;
8889
httpRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest");
8990
}
9091

9192
private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
9293
{
93-
JsonParseResult json = Json.Parse(Encoding.UTF8.GetString(body));
94-
GD.Print(json.Result);
94+
Godot.Collections.Dictionary json = Json.ParseString(Encoding.UTF8.GetString(body)).AsGodotDictionary();
95+
GD.Print(json["name"]);
9596
}
9697
}
9798

0 commit comments

Comments
 (0)