Skip to main content

Module http

Module http 

Source
Expand description

Native http module for making HTTP requests.

Exports: http.get, http.delete (Stage C); http.post_text, http.post_bytes, http.put_text, http.put_bytes (Stage D).

All functions are async. Uses reqwest under the hood. Policy gated: requires NetConnect permission.

Stage C HashMap-marshal P1(b) migration (2026-05-07):

  • Outer response shape {status, headers, body, ok} returns via TypedReturn::OkObjectPairs (Cluster #4 β shape, mirrors arrow.metadata precedent at arrow_module.rs:127).
  • Inner headers field carries HashMap<string, string> payload via ConcreteReturn::HashMapStringString (insertion-order preserved).
  • Options arg parsing uses Vec<(Arc<String>, Arc<HeapValue>)> FromSlot impl from Step 1 P1(b) infrastructure (crates/shape-runtime/src/marshal.rs, Stage C commit 36519f6).

Stage D N4 partial sign-off (2026-05-07; supervisor relay):

  • http.post/http.put legacy shape (single fn with body: any) replaced by typed overloads via Shape API split (stdlib-src/core/http.shape):
    • post_text(url, body: string, options) — sets Content-Type: text/plain; charset=utf-8
    • post_bytes(url, body: Array<int>, options) — sets Content-Type: application/octet-stream
    • put_text(url, body: string, options) — same content-type as post_text
    • put_bytes(url, body: Array<int>, options) — same as post_bytes
  • Body types map directly to existing FromSlot impls (Arc<String> at marshal.rs:129, Vec<u8> at marshal.rs:330) per supervisor’s “mechanical typed marshal” framing.
  • http.post_json(url, body: object, options) and http.put_json remain DEFERRED pending architectural sub-decision N7 — HeapValue→JSON serializer for HTTP / object-output marshal contexts. The body: object shape requires walking the polymorphic Vec<(Arc<String>, Arc<HeapValue>)> tree and producing a JSON string; per-variant serialization choices for Decimal, DataTable, Content, Temporal, TableView each represent a user-visible behavioral commitment that needs supervisor sign-off (architectural-adjacent helper, refused as bundled with Step 2 per the “no bundling architectural decisions” watchlist refusal). Surfaced via team-lead’s relay batch.

Tests deleted along with the legacy ValueWord-based fixtures, mirroring the csv_module migration (commit 9f6b1d3). New typed-marshal test harness arrives with the shape-vm cleanup workstream.

Functions§

create_http_module
Create the http module with async HTTP request functions.