You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
972 B
35 lines
972 B
extends Spatial
|
|
|
|
class_name GameServerRequests
|
|
|
|
var http:HTTPRequest
|
|
|
|
|
|
func _ready():
|
|
http = HTTPRequest.new()
|
|
add_child(http)
|
|
http.connect("request_completed",self, "_self_destroy")
|
|
|
|
|
|
func connect_http(node,function):
|
|
http.connect("request_completed",node,function)
|
|
|
|
|
|
func get_request(path:String):
|
|
http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_GET)
|
|
|
|
|
|
func post_request(path:String, data:String = ""):
|
|
http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_POST, data)
|
|
|
|
|
|
func put_request(path:String, data:String = ""):
|
|
http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_PUT, data)
|
|
|
|
|
|
func delete_request(path:String, data:String = ""):
|
|
http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_DELETE, data)
|
|
|
|
|
|
func _self_destroy(result, response_code, headers, body):
|
|
queue_free()
|