Hello there,
I had load a txt file on my server and I want to read this file (json format), but it doesn't work. I get the "error" code 0 and that's should be a success. The http request didn't jump to the function _on_request_completed. Where is the bug. I don't get any error message.
var link = https://example.com/menu/menu.txt
func download_json(link):
#$HTTPRequest.connect("request_completed", _on_request_completed)
#$HTTPRequest.request_completed.connect(self._on_request_completed)
var http_request = HTTPRequest.new()
add_child(http_request)
http_request.request_completed.connect(self._on_request_completed)
var error = await http_request.request("https://example.com/menu/menu.txt")
if error != OK:
push_error("An error occurred in the HTTP request.")
func _on_request_completed(result, response_code, headers, body):
Global.save.set_value("path", Global.menu_path)
print(body)
Thanks