Skip to content

feat(builtins): add http command (non-standard, HTTPie-inspired) #571

@chaliy

Description

@chaliy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions