How to clean/remove an http_request node after completion?

Godot Version

4.x

Question

In the documentation of Godot 4, when you want to make an HTTP request, you do an add_child, but when you do multiple requests, this child is never removed, I would like to remove it when the request is completed but I do not have access to the request anymore at this stage. How do you remove this node after the request has been completed? Or do I need to reuse this node?

before you add it as child you can do something like this:

http_request.request_completed.connect(http_request.queue_free.unbind(4))
add_child(http_request)

So where is the handle function? In the connect() method I put the handle function in here (Example: http_request.request_completed.connect(self.handle_response))

You can connect it to multiple functions:

http_request.request_completed.connect(self.handle_response))
http_request.request_completed.connect(http_request.queue_free.unbind(4))
add_child(http_request)
1 Like

Thanks! I made it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.