httpCreateClient (Function)

Signature: httpCreateClient(base_url: string, timeout: int) -> Result<int, Error>

Description: Creates an HTTP client and answers its handle, or an Error.

Parameters

  • base_url (string): Base URL for requests (e.g., "http://api.example.com")
  • timeout (int): Request timeout in milliseconds

Returns: Result<int, Error>

Example

print(match httpCreateClient("http://127.0.0.1:18898", 1000) {
    Success { value } => "closed: ${httpCloseClient(value) ?: -1}"
    Error { message } => "client error: ${message}"
})
client = httpCreateClient ("http://127.0.0.1:18898", 1000)
match client > 0
    true => print "closed: ${httpCloseClient client}"
    false => print "client error: ${client}"