Update rust_g to 0.5.0+a2 (#12865)

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
Werner
2021-12-19 23:22:29 +01:00
committed by GitHub
parent 0549da254f
commit 619ca5ce69
6 changed files with 80 additions and 20 deletions
+11 -3
View File
@@ -30,10 +30,12 @@
var/body
var/headers
var/url
/// If present response body will be saved to this file.
var/output_file
var/_raw_response
/datum/http_request/proc/prepare(method, url, body = "", list/headers)
/datum/http_request/proc/prepare(method, url, body = "", list/headers, output_file)
if (!length(headers))
headers = ""
else
@@ -43,15 +45,16 @@
src.url = url
src.body = body
src.headers = headers
src.output_file = output_file
/datum/http_request/proc/execute_blocking()
_raw_response = rustg_http_request_blocking(method, url, body, headers)
_raw_response = rustg_http_request_blocking(method, url, body, headers, build_options())
/datum/http_request/proc/begin_async()
if (in_progress)
crash_with("Attempted to re-use a request object.")
id = rustg_http_request_async(method, url, body, headers)
id = rustg_http_request_async(method, url, body, headers, build_options())
if (isnull(text2num(id)))
crash_with("Proc error: [id]")
@@ -59,6 +62,11 @@
else
in_progress = TRUE
/datum/http_request/proc/build_options()
if(output_file)
return json_encode(list("output_filename"=output_file,"body_filename"=null))
return "{}"
/datum/http_request/proc/is_complete()
if (isnull(id))
return TRUE