http
Generated by tinox doc
Blocking HTTP/1.1 client (GET/POST/PUT/DELETE/PATCH, plain http:// only, no TLS). Request headers are set thread-locally via Http::setHeader before a call; the response is inspected with the free httpStatusCode/httpBody/httpHeader functions. Used as the low-level transport under tinox.core.rest.client and tinox.core.oauth2.
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 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
class HttpClientResponse
Methods
fn statusCode() → Int64
fn body() → String
fn header(name: String) → String