浏览代码

Fixed example that was not working

Juozas Rastenis 5 年之前
父节点
当前提交
730b4d6294
共有 1 个文件被更改,包括 2 次插入2 次删除
  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
 
     func _ready():
-        pass
+        $HTTPRequest.connect("request_completed", self, "_on_request_completed")
 
     func _on_Button_pressed():
         $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())
         print(json.result)