Browse Source

Fixed example that was not working

Juozas Rastenis 5 years ago
parent
commit
730b4d6294
1 changed files with 2 additions and 2 deletions
  1. 2 2
      tutorials/networking/http_request_class.rst

+ 2 - 2
tutorials/networking/http_request_class.rst

@@ -28,12 +28,12 @@ Below is all the code we need to make it work. The URL points to an online API m
     extends CanvasLayer
     extends CanvasLayer
 
 
     func _ready():
     func _ready():
-        pass
+        $HTTPRequest.connect("request_completed", self, "_on_request_completed")
 
 
     func _on_Button_pressed():
     func _on_Button_pressed():
         $HTTPRequest.request("http://www.mocky.io/v2/5185415ba171ea3a00704eed")
         $HTTPRequest.request("http://www.mocky.io/v2/5185415ba171ea3a00704eed")
 
 
-    func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
+    func _on_request_completed(result, response_code, headers, body):
         var json = JSON.parse(body.get_string_from_utf8())
         var json = JSON.parse(body.get_string_from_utf8())
         print(json.result)
         print(json.result)