http
Generated by tinox doc
tinox.core.http, split out of the bundled stdlib as a standalone tinox-central package.
Get request
import tinox.core.http
class Main
{
fnc main() -> Int32
{
Http::setHeader("Accept", "application/json")
const resp: HttpClientResponse = Http::get("http://localhost:8080/api/v1/packages")
Http::clearHeaders()
println("status: " + httpStatusCode(resp).toString())
println("body: " + httpBody(resp))
return 0
}
}
fn httpGet(url: String) → HttpClientResponse
fn httpPost(url: String, body: String) → HttpClientResponse
fn httpPut(url: String, body: String) → HttpClientResponse
fn httpDelete(url: String) → HttpClientResponse
fn httpPatch(url: String, body: String) → HttpClientResponse
fn httpSetHeader(name: String, value: String) → Nothing
fn httpClearHeaders() → Nothing
fn httpSetTlsCaCertFile(path: String) → Nothing
fn httpSetTlsClientCertFile(certPath: String, keyPath: String) → Nothing
fn httpSetTlsInsecureSkipVerify(enabled: Int64) → Nothing
fn httpClearTlsConfig() → Nothing
fn httpRequestEx(method: String, url: String, body: String, headers: String, ca: String, cert: String, key: String, insecure: Int64, connectMs: Int64, readMs: Int64, totalMs: Int64) → HttpClientResponse
fn httpError(resp: HttpClientResponse) → String
fn httpStatusCode(resp: HttpClientResponse) → Int64
fn httpBody(resp: HttpClientResponse) → String
fn httpHeader(resp: HttpClientResponse, name: String) → String
class Http
Methods
fn get(url: String) → HttpClientResponse
fn post(url: String, body: String) → HttpClientResponse
fn put(url: String, body: String) → HttpClientResponse
fn delete(url: String) → HttpClientResponse
fn patch(url: String, body: String) → HttpClientResponse
fn setHeader(name: String, value: String) → Nothing
fn clearHeaders() → Nothing
fn setTlsCaCertFile(path: String) → Nothing
fn setTlsClientCertFile(certPath: String, keyPath: String) → Nothing
fn setTlsInsecureSkipVerify(enabled: Bool) → Nothing
fn clearTlsConfig() → Nothing
class HttpClient
Fields
headerBlock | String | |
caCert | String | |
clientCert | String | |
clientKey | String | |
insecure | Int64 | |
connectMs | Int64 | |
readMs | Int64 | |
totalMs | Int64 |
Methods
fn create() → HttpClient
fn header(name: String, value: String) → HttpClient
fn tlsCaCertFile(path: String) → HttpClient
fn tlsClientCertFile(certPath: String, keyPath: String) → HttpClient
fn tlsInsecureSkipVerify(enabled: Bool) → HttpClient
fn timeouts(connectMs: Int64, readMs: Int64, totalMs: Int64) → HttpClient
fn request(method: String, url: String, body: String) → HttpClientResponse
fn get(url: String) → HttpClientResponse
fn post(url: String, body: String) → HttpClientResponse
fn put(url: String, body: String) → HttpClientResponse
fn delete(url: String) → HttpClientResponse
fn patch(url: String, body: String) → HttpClientResponse
class HttpClientResponse
Methods
fn error() → String
fn failed() → Bool
fn statusCode() → Int64
fn body() → String
fn header(name: String) → String