0 votes

I'm doing some tests with http requests.
i have the following code on my scene

var http_request: HTTPRequest

# Called when the node enters the scene tree for the first time.
func _ready():
    http_request = HTTPRequest.new()
    add_child(http_request)
    http_request.request_completed.connect(self.on_request_completed)


func on_request_completed(result, response_code, headers, body):
    var json = JSON.new()
    print('created json')
    json.parse(body.get_string_from_utf8())
    print('parsed json')
    print(str(json))
    $CenterContainer/VBoxContainer/Label.text = str(json.get_data())


func _on_button_pressed():
    http_request.request("https://212.227.227.158/")
    print('request')

it works fine when debugging
enter image description here

but when i compile it and upload to the server it returns an error and i don't understand why
enter image description here

The http request returns the correct json

Godot version v4.0.beta9.official.e780dc332
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.