Summary
A non-standard builtin for intuitive HTTP requests, inspired by HTTPie. curl is powerful but its flags are cryptic. http provides a human-friendly interface for the common case: API calls with JSON bodies.
Proposed Syntax
http [METHOD] URL [HEADER:value...] [field=value...] [field:=json...]
Key Differences from curl
| Feature |
curl |
http |
| GET request |
curl -s https://api.example.com |
http GET api.example.com |
| POST JSON |
curl -X POST -H 'Content-Type: application/json' -d '{"name":"x"}' |
http POST api.example.com name=x |
| Auth header |
curl -H 'Authorization: Bearer tok' |
http api.example.com Authorization:Bearer\ tok |
| Pretty output |
curl -s | jq . |
Built-in (default) |
Conventions
| Syntax |
Meaning |
field=value |
JSON string field |
field:=123 |
Raw JSON value (number, bool, array, object) |
field:=true |
JSON boolean |
Header:value |
Request header (colon in key position) |
== |
Query parameter: page==2 → ?page=2 |
Use Cases
# GET with pretty output
http GET api.example.com/users
# POST with JSON body (automatic Content-Type)
http POST api.example.com/users name=Alice age:=30 active:=true
# With auth
http GET api.example.com/me Authorization:"Bearer $TOKEN"
# Query params
http GET api.example.com/search q==bashkit page==1
# Pipe JSON body
echo '{"bulk": true}' | http POST api.example.com/import
# Download
http GET example.com/file.tar.gz > file.tar.gz
llm_hint()
Some("http: HTTPie-style requests. `http GET url`, `http POST url key=val key:=123`. Auto JSON, pretty output. Use curl for advanced needs.")
Implementation Notes
- Reuses existing HTTP client infrastructure (allowlist still applies)
- Default method is GET if URL-only, POST if body fields present
- Auto-sets
Content-Type: application/json when body fields used
- Pretty-prints JSON responses by default (with colors if possible)
--raw flag to disable pretty printing
- NOT a replacement for curl — curl handles file uploads, custom protocols, certs
Summary
A non-standard builtin for intuitive HTTP requests, inspired by HTTPie.
curlis powerful but its flags are cryptic.httpprovides a human-friendly interface for the common case: API calls with JSON bodies.Proposed Syntax
Key Differences from curl
curl -s https://api.example.comhttp GET api.example.comcurl -X POST -H 'Content-Type: application/json' -d '{"name":"x"}'http POST api.example.com name=xcurl -H 'Authorization: Bearer tok'http api.example.com Authorization:Bearer\ tokcurl -s | jq .Conventions
field=valuefield:=123field:=trueHeader:value==page==2→?page=2Use Cases
llm_hint()
Implementation Notes
Content-Type: application/jsonwhen body fields used--rawflag to disable pretty printing