Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
Status
HTTPClient.swift:72enum Status
Cases
case disconnected
Status: Disconnected from the server.
case resolving
Status: Currently resolving the hostname for the given URL into an IP.
case cantResolve
Status: DNS failure: Can’t resolve the hostname for the given URL.
case connecting
Status: Currently connecting to server.
case cantConnect
Status: Can’t connect to the server.
case connected
Status: Connection established.
case requesting
Status: Currently sending request.
case body
Status: HTTP body received.
case connectionError
Status: Error in HTTP connection.
case tlsHandshakeError
Status: Error in TLS handshake.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (22) members.
Types
Type members
Instance members
var blockingModeEnabled: Bool
If
true
, execution will block until all data is read from the response.var connection: StreamPeer?
The connection to use for this client.
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.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.