feat: http.request v0.1.0 — generic HTTP client

First release. Pure-WASM HTTP client built on waki 0.5 for
F∆I flow steps that need to call REST APIs.

Capability: http.request@0.1.0

Inputs: method (GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS),
url, headers (JSON object string), body (UTF-8).

Outputs: status (decimal text), headers (JSON object), body
(UTF-8 lossy).

Permissions: net: *. The wildcard is deliberate — operators
clamp to specific hosts via their operator-policy ceiling.

6 unit tests on the headers-input parser (empty / strings /
numbers coerced / non-object rejected / nested rejected /
malformed JSON rejected).

Bundle: target/wasm32-wasip2/release/http_request.wasm
(~120 KiB stripped).

v0.2.0 candidates: http.request-bytes for binary payloads,
per-request timeout / retry inputs, cookie-jar.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-05-25 14:16:09 +02:00
commit 4681d0bb2c
8 changed files with 1194 additions and 0 deletions

38
Cargo.toml Normal file
View file

@ -0,0 +1,38 @@
# Standalone Cargo.toml — targets wasm32-wasip2.
#
# Build with:
# cargo build --release --target wasm32-wasip2
[package]
name = "http_request"
version = "0.1.0"
edition = "2024"
authors = ["Dr. Stefan Flemming <platform@flemming.ai>"]
license = "Apache-2.0"
publish = false
description = "F∆I module — generic HTTP client (GET/POST/PUT/PATCH/DELETE/HEAD/OPTIONS)"
repository = "https://git.flemming.ai/fai-modules/http-request"
rust-version = "1.85"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
fai-module-sdk = { git = "https://git.flemming.ai/fai/module-sdk.git", branch = "main" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# WASI-0.2 HTTP client — same one llm-chat / text-translate use.
# Only compiled into the wasm32-wasip2 build; the rlib target
# we don't actually link against on the host doesn't need it.
[target.'cfg(target_arch = "wasm32")'.dependencies]
waki = "0.5"
[dev-dependencies]
serde_json = "1"
[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
strip = true