[HTTP]ClientThe convenience facade: class-side helpers for the common verbs. Kept thin so a future stateful client (base URL, default headers, pooling) can be an *instance* of this class without disturbing these.
GET url and return the [HTTP]Response; redirects are followed. The body arrives stream-backed — read it with .body.text / .json / .bytes, or stream it with .body.chunks.
use std:net/http; var resp = [HTTP]Client.get:'https://example.org/'; resp.status; "* e.g. 200 resp.body.text "* the whole body as a String
GET with extra request headers — #(name value) pairs.
[HTTP]Client.get:url headers:#( #('Accept' 'application/json') )
POST body to url. The body normalizes as [HTTP]Request body: does — a Map or List is JSON-encoded (Content-Type application/json), a String sends as its UTF-8 bytes, Bytes goes as-is, an [HTTP]Body is used unchanged.
resp = [HTTP]Client.post:'https://api.example.org/users' body:#{ 'name':'Quoin' }
POST with extra request headers — #(name value) pairs.
A fresh [HTTP]Request builder for url — the escape hatch for custom verbs, headers, a body, insecure:, or redirect settings; finish the chain with .send.
resp = (([HTTP]Client.request:'https://example.org/x').method:'DELETE').send