Public repository for MUR pre alpha
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.

34 lines
972 B

  1. extends Spatial
  2. class_name GameServerRequests
  3. var http:HTTPRequest
  4. func _ready():
  5. http = HTTPRequest.new()
  6. add_child(http)
  7. http.connect("request_completed",self, "_self_destroy")
  8. func connect_http(node,function):
  9. http.connect("request_completed",node,function)
  10. func get_request(path:String):
  11. http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_GET)
  12. func post_request(path:String, data:String = ""):
  13. http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_POST, data)
  14. func put_request(path:String, data:String = ""):
  15. http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_PUT, data)
  16. func delete_request(path:String, data:String = ""):
  17. http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_DELETE, data)
  18. func _self_destroy(result, response_code, headers, body):
  19. queue_free()