HTTP Request
Holder datum for ingame HTTP requests
Holds information regarding to methods used, URL, and response, as well as job IDs and progress tracking for async requests
Vars | |
_raw_response | The raw response, which will be decoeded into a /datum/http_response |
---|---|
body | Body of the request being sent |
headers | Request headers being sent |
id | The ID of the request (Only set if it is an async request) |
in_progress | Is the request in progress? (Only set if it is an async request) |
method | HTTP method used |
output_file | If present response body will be saved to this file. |
url | URL that the request is being sent to |
Procs | |
begin_async | Async execution starter |
build_options | Options builder |
execute_blocking | Blocking executor |
into_response | Response deserializer |
is_complete | Async completion checker |
prepare | Preparation handler |
Var Details
_raw_response
The raw response, which will be decoeded into a /datum/http_response
body
Body of the request being sent
headers
Request headers being sent
id
The ID of the request (Only set if it is an async request)
in_progress
Is the request in progress? (Only set if it is an async request)
method
HTTP method used
output_file
If present response body will be saved to this file.
url
URL that the request is being sent to
Proc Details
begin_async
Async execution starter
Tells the request to start executing inside its own thread inside RUSTG Preferred over blocking.
build_options
Options builder
Builds a set of request options Apparently this is only currently used for output_file purposes
execute_blocking
Blocking executor
Remains as a proof of concept to show it works, but should NEVER be used to do FFI halting the entire DD process up Async rqeuests are much preferred.
into_response
Response deserializer
Takes a HTTP request object, and converts it into a /datum/http_response The entire thing is wrapped in try/catch to ensure it doesnt break on invalid requests Can be called on async and blocking requests
is_complete
Async completion checker
Checks if an async request has been complete Has safety checks built in to compensate if you call this on blocking requests, or async requests which have already finished
prepare
Preparation handler
Call this with relevant parameters to form the request you want to make
Arguments:
- _method - HTTP Method to use, see code/rust_g.dm for a full list
- _url - The URL to send the request to
- _body - The body of the request, if applicable
- _headers - Associative list of HTTP headers to send, if applicable
- _output_file - If present response body will be saved to this file.