← all modules
module

stdlib::http::client

defined in C:\Users\bye45\.glide\bin/src/stdlib/http/client.glide

A request being assembled — mutable holder; not the same shape as

struct struct HttpClientRequest

A request being assembled — mutable holder; not the same shape as the server-side HttpRequest (which is parsed-from-wire).

struct struct HttpClient

Persistent client config. Keep one around to share defaults across many requests; for one-shot calls use the http_get / http_post* free functions which build a default client per call.

fn fn http_get(url: string) -> !*HttpResponse

One-shot GET with a default client. For multiple calls or shared state (cookies, timeouts), use HttpClient::new() once and reuse.

glide
let r: !*HttpResponse = http_get("https://example.com/");
if r.ok && r.val.status == 200 { println!(r.val.body.len(), "bytes"); }
fn fn http_post_json(url: string, body: string) -> !*HttpResponse

One-shot JSON POST with a default client.

glide
let r: !*HttpResponse = http_post_json("https://api/login",
                                       "{\"user\":\"a\",\"pass\":\"b\"}");
struct struct ParsedUrl