Indent every script with tabs, like the Godot editor does
This commit is contained in:
1 parent
8c1987807c
commit
bad4b3ad8b
35 files changed
+1653
-1653
No files matched your search
+22
-22
@@ -12,31 +12,31 @@ var _owner: Node
|
||||
|
||||
|
||||
func _init(owner: Node) -> void:
|
||||
_owner = owner
|
||||
_owner = owner
|
||||
|
||||
|
||||
## Requests [param url] and calls [param on_complete] with
|
||||
## [code](response_code: int, body: PackedByteArray)[/code]. Connection errors and
|
||||
## timeouts are reported with response code 0.
|
||||
func request(url: String, method: int, on_complete: Callable) -> void:
|
||||
var http_request: HTTPRequest = HTTPRequest.new()
|
||||
http_request.timeout = timeout_seconds
|
||||
_owner.add_child(http_request)
|
||||
http_request.request_completed.connect(
|
||||
func(
|
||||
result: int,
|
||||
response_code: int,
|
||||
_headers: PackedStringArray,
|
||||
body: PackedByteArray,
|
||||
) -> void:
|
||||
http_request.queue_free()
|
||||
on_complete.call(response_code if result == HTTPRequest.RESULT_SUCCESS else 0, body)
|
||||
)
|
||||
var headers: PackedStringArray = []
|
||||
if method == HTTPClient.METHOD_PUT:
|
||||
headers.append("Content-Type: application/json")
|
||||
var error: int = http_request.request(url, headers, method)
|
||||
if error != OK:
|
||||
http_request.queue_free()
|
||||
push_error("Could not send request to %s (error %d)" % [url, error])
|
||||
on_complete.call(0, PackedByteArray())
|
||||
var http_request: HTTPRequest = HTTPRequest.new()
|
||||
http_request.timeout = timeout_seconds
|
||||
_owner.add_child(http_request)
|
||||
http_request.request_completed.connect(
|
||||
func(
|
||||
result: int,
|
||||
response_code: int,
|
||||
_headers: PackedStringArray,
|
||||
body: PackedByteArray,
|
||||
) -> void:
|
||||
http_request.queue_free()
|
||||
on_complete.call(response_code if result == HTTPRequest.RESULT_SUCCESS else 0, body)
|
||||
)
|
||||
var headers: PackedStringArray = []
|
||||
if method == HTTPClient.METHOD_PUT:
|
||||
headers.append("Content-Type: application/json")
|
||||
var error: int = http_request.request(url, headers, method)
|
||||
if error != OK:
|
||||
http_request.queue_free()
|
||||
push_error("Could not send request to %s (error %d)" % [url, error])
|
||||
on_complete.call(0, PackedByteArray())
|
||||
Reference in new issue
Block a user