Stdlib: HTTP client builtins #247

Closed
opened 2026-01-12 02:37:02 +00:00 by navicore · 1 comment
navicore commented 2026-01-12 02:37:02 +00:00 (Migrated from github.com)

Summary

Add HTTP client builtins to enable outbound HTTP/HTTPS requests. Currently Seq has HTTP server capabilities but no way to make client requests.

Proposed API

# Simple GET request
"https://api.example.com/users" http.get
# ( url -- Response )

# POST with body
"https://api.example.com/users" body "application/json" http.post
# ( url body content-type -- Response )

# Response accessors
response http.status    # ( Response -- Int )
response http.body      # ( Response -- String )
response http.header    # ( Response String -- String ) get header by name

# Full request builder (for headers, auth, etc.)
http.request
  "https://api.example.com" http.url!
  "Bearer token123" "Authorization" http.header!
  http.get!
# ( -- Response )

Implementation

FFI wrapper around ureq crate:

  • Pure Rust, minimal dependencies
  • Blocking API (fits Seq's strand model)
  • TLS via rustls (memory-safe)

Estimated effort: 2-3 days

Deliverables Checklist

  • Runtime builtins in crates/runtime/src/http_client.rs
  • Unit tests for each function
  • Integration tests in tests/integration/src/test-http-client.seq
  • LSP support: signatures in BUILTIN_SIGNATURES, docs in BUILTIN_DOCS
  • Example: examples/http/api-client.seq (REST API consumer)
  • Example: examples/http/json-fetch.seq (fetch and parse JSON)
  • Update docs/BATTERIES_INCLUDED.md status

Use Cases Unlocked

  • REST API clients
  • Webhook delivery
  • Web scraping
  • OAuth flows
  • Microservice communication

Priority

HIGH - This is the most requested missing capability.

References

## Summary Add HTTP client builtins to enable outbound HTTP/HTTPS requests. Currently Seq has HTTP server capabilities but no way to make client requests. ## Proposed API ```seq # Simple GET request "https://api.example.com/users" http.get # ( url -- Response ) # POST with body "https://api.example.com/users" body "application/json" http.post # ( url body content-type -- Response ) # Response accessors response http.status # ( Response -- Int ) response http.body # ( Response -- String ) response http.header # ( Response String -- String ) get header by name # Full request builder (for headers, auth, etc.) http.request "https://api.example.com" http.url! "Bearer token123" "Authorization" http.header! http.get! # ( -- Response ) ``` ## Implementation FFI wrapper around `ureq` crate: - Pure Rust, minimal dependencies - Blocking API (fits Seq's strand model) - TLS via `rustls` (memory-safe) Estimated effort: 2-3 days ## Deliverables Checklist - [ ] Runtime builtins in `crates/runtime/src/http_client.rs` - [ ] Unit tests for each function - [ ] Integration tests in `tests/integration/src/test-http-client.seq` - [ ] LSP support: signatures in `BUILTIN_SIGNATURES`, docs in `BUILTIN_DOCS` - [ ] Example: `examples/http/api-client.seq` (REST API consumer) - [ ] Example: `examples/http/json-fetch.seq` (fetch and parse JSON) - [ ] Update `docs/BATTERIES_INCLUDED.md` status ## Use Cases Unlocked - REST API clients - Webhook delivery - Web scraping - OAuth flows - Microservice communication ## Priority HIGH - This is the most requested missing capability. ## References - See `docs/BATTERIES_INCLUDED.md` Priority 1: HTTP Client - ureq: https://github.com/algesten/ureq
navicore commented 2026-01-12 04:51:40 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/pull/255
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-seq#247
No description provided.