Instance Propertymigueldeicaza.swiftgodot 0.45.0SwiftGodot
connection
The connection to use for this client.
HTTPClient.swift:321final var connection: StreamPeer? { get set }
Other members in extension
Types
Type members
Instance members
var blockingModeEnabled: Bool
If
true
, execution will block until all data is read from the response.var readChunkSize: Int32
The size of the buffer used and maximum bytes to read per iteration. See
readResponseBodyChunk
.func close(
) Closes the current connection, allowing reuse of this
HTTPClient
.func connectToHost(String, port: Int32, tlsOptions: TLSOptions?
) -> GodotError Connects to a host. This needs to be done before any requests are sent.
func getResponseBodyLength(
) -> Int Returns the response’s body length.
func getResponseCode(
) -> Int32 Returns the response’s HTTP status code.
func getResponseHeaders(
) -> PackedStringArray Returns the response headers.
func getResponseHeadersAsDictionary(
) -> GDictionary Returns all response headers as a Dictionary of structure
{ "key": "value1; value2" }
where the case-sensitivity of the keys and values is kept like the server delivers it. A value is a simple String, this string can have more than one value where “; “ is used as separator.func getStatus(
) -> HTTPClient.Status Returns a
Status
constant. Need to callpoll
in order to get status updates.func hasResponse(
) -> Bool If
true
, thisHTTPClient
has a response available.func isResponseChunked(
) -> Bool If
true
, thisHTTPClient
has a response that is chunked.func poll(
) -> GodotError This needs to be called in order to have any request processed. Check results with
getStatus
.func queryStringFromDict(fields: GDictionary
) -> String Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary, e.g.:
func readResponseBodyChunk(
) -> PackedByteArray Reads one chunk from the response.
func request(method: HTTPClient.Method, url: String, headers: PackedStringArray, body: String
) -> GodotError Sends a request to the connected host.
func requestRaw(method: HTTPClient.Method, url: String, headers: PackedStringArray, body: PackedByteArray
) -> GodotError Sends a raw request to the connected host.
func setHttpProxy(host: String, port: Int32
) Sets the proxy server for HTTP requests.
func setHttpsProxy(host: String, port: Int32
) Sets the proxy server for HTTPS requests.