Fix ternary conditional warning

This commit is contained in:
JeremyStar™ 2024-03-27 15:09:19 +01:00
parent 2a2a7cd31d
commit da44b1d116
2 changed files with 3 additions and 3 deletions

View file

@ -17,7 +17,7 @@ The returned `Dictionary` has the following structure (example):
{ "result": 0, "http_code": 200, "headers": [ "Server": "nginx" ], "body": [], "body_utf8": [] }
^ ^ ^ ^ ^
| | | | |
| | | | --------- The body from the server, as a UTF-8 string (if 'parse_utf8' is true)
| | | | --------- The body from the server, as a UTF-8 string (set to "" if 'parse_utf8' is false)
| | | ----------------------- The body from the server, as bytes
| | ------------------------------------------------------ A array of headers
| ---------------------------------------------------------------------- The HTTP response code
@ -43,7 +43,7 @@ The returned `Dictionary`s have the following structure (example):
{ "result": 0, "http_code": 200, "headers": [ "Server": "nginx" ], "body": [], "body_utf8": [] }
^ ^ ^ ^ ^
| | | | |
| | | | --------- The body from the server, as a UTF-8 string (if 'parse_utf8' is true)
| | | | --------- The body from the server, as a UTF-8 string (set to "" if 'parse_utf8' is false)
| | | ----------------------- The body from the server, as bytes
| | ------------------------------------------------------ A array of headers
| ---------------------------------------------------------------------- The HTTP response code

View file

@ -77,7 +77,7 @@ func start_download(id: int, parse_utf8: bool) -> void:
download.use_threads = true
var lambda: Callable = func(result: int, http_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
logger.verbf("Edl", "Request " + str(id) + " completed\nResult: " + str(result) + "\nHTTP response code: " + str(http_code) + "\nHeaders:\n" + str(headers) + "\nBody size: " + str(body.size()) + " Bytes // " + str(core.misc.byte2mib(body.size(), true)) + " MiB")
list_complete.merge({ id: { "result": result, "http_code": http_code, "headers": headers, "body": body, "body_utf8": body.get_string_from_utf8() if !parse_utf8 else null } })
list_complete.merge({ id: { "result": result, "http_code": http_code, "headers": headers, "body": body, "body_utf8": body.get_string_from_utf8() if !parse_utf8 else "" } })
list_active.erase(id)
download.connect("request_completed", lambda)
add_child(download)