A requests-style HTTP client for Corros — GET, POST, PUT, DELETE, HEAD, binary downloads, query strings, and a full JSON parser/serializer, written entirely in Corros, the from-scratch scripting language. No Python, no requests, no dependencies — just Corros.
| Python package | courierforge |
|---|---|
requests.get(url) |
courier_get(url, headers) |
requests.post(url, json=...) |
courier_post(url, body, headers) |
r.status_code |
r["status"] |
r.headers[...] |
courier_header(r, "name") |
r.text |
r["body"] |
r.json() |
courier_json(r["body"]) |
requests.get(url, params=...) |
courier_get(courier_url(base, params), nil) |
requests.get(...).content / streaming |
courier_download(url, path) |
curl -fsSL https://raw.githubusercontent.com/CocoCopi/courierforge/main/install.sh | sh
courierforge get https://example.comOr from source:
git clone https://github.com/CocoCopi/courierforge
cd courierforge
corros src/cli.cro get https://example.comadopt "/path/to/courierforge/src/courier.cro" // or wherever you installed it
forge r = courier_get("https://example.com", nil)
speak("status:", r["status"]) // 200
speak("type:", courier_header(r, "content-type")) // text/html
forge j = courier_json(courier_get("https://jsonplaceholder.typicode.com/todos/1", nil)["body"])
speak(j["title"]) // parsed JSON
forge r2 = courier_post("https://httpbin.org/post", courier_json_dump({ "name": "corros" }),
{ "content-type": "application/json" })
courier_download("https://example.com/page", "/tmp/page.html") // binary-safe
| function | does |
|---|---|
courier_get(url, headers) |
GET → {status, headers, body, error} |
courier_post(url, body, headers) |
POST raw body |
courier_put(url, body, headers) |
PUT raw body |
courier_delete(url, headers) |
DELETE |
courier_head(url, headers) |
HEAD |
courier_download(url, path) |
binary-safe streaming download → status |
courier_header(resp, name) |
header value (case-insensitive) or "" |
courier_params(map) |
{"a":1,"msg":"hi there"} → a=1&msg=hi%20there |
courier_url(base, params) |
base + ?query (handles existing ?) |
courier_json(text) |
parse JSON → Corros values (maps, lists, nums, strings, bools, nil) |
courier_json_dump(value) |
Corros values → JSON text |
Requests shell out to curl (present everywhere Corros runs): redirects
followed (up to 5), 15s connect / 90s total timeouts, headers parsed into a
map, bodies returned verbatim. Binary downloads use the Corros language's own
http_download builtin (streams raw bytes, never through a string). The JSON
parser and serializer are a hand-written recursive-descent implementation in
Corros itself — no third-party code anywhere.
bash tests/run.sh # boots a local echo server, runs the offline suiteThe suite covers GET/POST/PUT, custom headers, JSON parse + dump round-trips,
and query-string building — fully offline (plus examples/demo.cro for a
live https check).
MIT — see LICENSE. Built with Corros; see the Corros repo for the language.
