« All posts

Fitz Adds Built-in HTTP Client: Zero Deps, Native Async

Fitz turns HTTP client calls (get/post/put/delete) into language builtins: zero deps, native async, bit-for-bit interpreter/binary parity.

The Fitz language has moved outbound HTTP calls (http.get, post, put, delete, head, request) into the core language as native, async-first builtins, eliminating the need for external packages. The motivation surfaced while building fitzwatch, an open-source status page written in Fitz, whose core loop depends on periodic http.head health checks — a gap that made the language impractical for real services. Within a week, six builtins landed with bit-for-bit behavioral parity between the interpreter (fitz run) and the compiled binary (fitz build), full static type checking, and zero external dependencies in the final artifact.

The comparison highlights how Python needs separate requests/httpx libraries for sync versus async, JS's axios throws by default on 4xx/5xx, and Rust's reqwest requires extra crates and manual client setup. Fitz instead exposes one async API returning a fixed HttpClientResponse type (status, body, headers, duration_ms), with JSON bodies serialized automatically.

The key design choice is in error handling: 4xx/5xx responses are not treated as errors — they arrive as Ok(response), preserving the body for inspection — while only transport-level failures (DNS, timeout, TLS handshake) surface as Result::Err. The compiler's exhaustiveness checker forces developers to handle both Ok and Err branches, and static rustls TLS removes any OpenSSL dependency on the host.