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");
let 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 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 HttpClientResponse
Methods
fn statusCode() → Int64
fn body() → String
fn header(name: String) → String