01What it is
An HTTP and WebSocket client for MoonBit, written for the way a program actually uses one: a request now and then, a connection kept for the rest, and a body too large to hold.
h2c, and HTTP/3 over QUIC when asked for.
fetch, behind the same Client.
Body value — text, bytes, JSON, a form, a multipart, or a source
produced while the request goes out — so a request cannot carry two.
Client::stream returns once the head is in; next hands
over the octets as they arrive, for event feeds and downloads.
02The request, before the wire
Three lines of MoonBit on the left; on the right, the octets they become — written by this library, in this page, just now.
let client = @moonfetch.Client::new(timeout=Some(5000))
let page = client.get("https://example.com/a?b=1")
println(page.status)
The client adds what a request must carry and nothing else reports: the host, the user agent, the fields it accepts.
the engine loads with the page…
The rest — frames, a live answer, a game about head-of-line blocking — is on the ShowCase.
03On the shelf
0.2.0, published on MoonCakes