Skip to main content

Curl

@svendowideit/curlv2026.10.23.1· MIT(was none)· 1d agoBEHAVIORSACCEPTED WARNINGS
01README

A tracked curl wrapper: every HTTP request records exactly what went out and what came back — headers, cookies, body, redirects and timing — with secrets masked, and a persistent cookie jar that carries a session across requests. WHAT IT DOES

Wraps the curl binary in a swamp model, so an HTTP call leaves evidence instead of vanishing into a terminal. Each request records the method, URL, the headers the wrapper applied, the cookies sent and received, every response header block (including the redirect chain), the body (capped, and optionally saved in full), timing, the exact curl argv, the exit code and stderr. Authorization, cookie, API-key and Set-Cookie values are masked by default, so the record is safe to keep in swamp data. Prefer it over ad-hoc curl: a per-instance Netscape cookie jar (reuseCookies) makes a login followed by authenticated calls a matter of running methods in sequence, and the whole exchange is queryable later with swamp data.

INSTALL

swamp extension pull @svendowideit/curl

DEPENDENCIES

The curl binary, which must be on PATH (or set the curlPath global argument). No other swamp extension is required, and nothing is installed on the host.

RUN

# Send a request and keep the full in/out record. The instance is
# auto-created on first use.
swamp model @svendowideit/curl method run request http \
  --input url="https://api.github.com/repos/denoland/deno"

# POST JSON and fail the run on a 4xx/5xx — the record is written first,
# so the evidence survives the failure.
swamp model @svendowideit/curl method run post http \
  --input url="https://httpbin.org/post" \
  --input 'dataJson:json={"hello":"world"}' \
  --input failOnHttpError=true

# Inspect the persistent cookie jar to see what a login-style request
# stored, and whether it will be reused.
swamp model @svendowideit/curl method run cookie-jar http

CONFIGURE

Optional global arguments (set at model creation with --global-arg key=value): cookieJar, reuseCookies, userAgent, defaultHeaders, followRedirects, maxRedirects, insecure, timeoutMs, connectTimeoutMs, maxBodyBytes, redactHeaders, redactCookieValues, stateDir and curlPath. Per call: url, method, headers, query, data, dataJson, dataFile, form, multipart, files, cookies, user, bearerToken, label, saveBody, outputFile and the reuseCookies/followRedirects/insecure/timeoutMs/ failOn* overrides. See the README for the full tables.

UPGRADE

This extension installs nothing on the host, so an upgrade has nothing to rebuild or reconcile. Refresh the pulled model type and its bundled files with one idempotent command:

  swamp extension update

Model definitions record the version they were created with; the model's bundled upgrades entry migrates them automatically on the next method run, and neither swamp data nor the cookie jar is touched.

WHAT IT INSTALLS

Nothing on the host — no services, cron triggers, daemons or webhooks. It runs the curl binary, reads and writes the cookie jar under stateDir, and writes swamp resources (and a body file when saveBody is set).

02Behaviors1
@svendowideit/curlv2026.10.23.1curl.ts

Global Arguments

ArgumentTypeDescription
name?stringModel instance name (supplied by swamp; used to derive the cookie jar).
cookieJar?stringPath to a persistent cookie jar file. Empty derives
reuseCookies?booleanSend cookies already stored in the jar on each request.
defaultHeaders?arrayHeaders applied to every request, each as "Name: Value".
followRedirects?booleanFollow HTTP redirects (curl --location).
maxRedirects?numberMaximum redirects to follow.
insecure?booleanSkip TLS certificate verification (curl --insecure).
timeoutMs?numberTotal request timeout in milliseconds.
connectTimeoutMs?numberConnection timeout in milliseconds.
maxBodyBytes?numberMaximum bytes of a body recorded in a resource (0 records none).
redactHeaders?arrayHeader names whose values are masked in the recorded request/response.
redactCookieValues?booleanMask cookie values in the recorded output.
fn request(url: string, method?: string, headers?: array, query?: record, data?: string, dataJson?: unknown, dataFile?: string, form?: record, multipart?: record, files?: record, cookies?: array, user?: string, bearerToken?: string, label?: string, saveBody?: boolean, outputFile?: string, maxBodyBytes?: number, reuseCookies?: boolean, followRedirects?: boolean, insecure?: boolean, timeoutMs?: number, failOnHttpError?: boolean, failOnCurlError?: boolean)
Perform an HTTP request with curl and record everything that went out
ArgumentTypeDescription
urlstringURL to request.
method?stringHTTP method. Empty = auto (POST when a body is supplied, otherwise GET).
headers?arrayExtra request headers, each as "Name: Value". Override globals.
query?recordQuery parameters appended to the URL.
data?stringRaw request body, sent byte-for-byte and recorded (truncated).
dataJson?unknownBody serialized as JSON; sets Content-Type: application/json.
dataFile?stringPath of a file to send as the body (curl --data-binary @file). The
form?recordForm fields sent as application/x-www-form-urlencoded.
multipart?recordMultipart form fields (curl --form name=value). Use for APIs that take
files?recordFiles attached as multipart fields (curl --form name=@path). Combine with
cookies?arrayCookies to send for this request, each as "name=value".
user?stringuser:password for HTTP basic auth (curl --user).
bearerToken?stringBearer token added as an Authorization header.
label?stringName for the request record (empty = a generated name). Also names a
saveBody?booleanStore the full response body as a `body` file resource.
outputFile?stringAlso write the response body to this path.
maxBodyBytes?numberOverride the global recorded-body cap for this request.
reuseCookies?booleanOverride the global reuseCookies for this request.
followRedirects?booleanOverride the global followRedirects for this request.
insecure?booleanOverride the global insecure for this request.
timeoutMs?numberOverride the global timeoutMs for this request.
failOnHttpError?booleanFail the run when the final status is 400+. The record is still written
failOnCurlError?booleanFail the run when curl exits non-zero. The record is still written
fn get(url: string, method?: string, headers?: array, query?: record, data?: string, dataJson?: unknown, dataFile?: string, form?: record, multipart?: record, files?: record, cookies?: array, user?: string, bearerToken?: string, label?: string, saveBody?: boolean, outputFile?: string, maxBodyBytes?: number, reuseCookies?: boolean, followRedirects?: boolean, insecure?: boolean, timeoutMs?: number, failOnHttpError?: boolean, failOnCurlError?: boolean)
Thin `request` wrapper that forces the GET method.
ArgumentTypeDescription
urlstringURL to request.
method?stringHTTP method. Empty = auto (POST when a body is supplied, otherwise GET).
headers?arrayExtra request headers, each as "Name: Value". Override globals.
query?recordQuery parameters appended to the URL.
data?stringRaw request body, sent byte-for-byte and recorded (truncated).
dataJson?unknownBody serialized as JSON; sets Content-Type: application/json.
dataFile?stringPath of a file to send as the body (curl --data-binary @file). The
form?recordForm fields sent as application/x-www-form-urlencoded.
multipart?recordMultipart form fields (curl --form name=value). Use for APIs that take
files?recordFiles attached as multipart fields (curl --form name=@path). Combine with
cookies?arrayCookies to send for this request, each as "name=value".
user?stringuser:password for HTTP basic auth (curl --user).
bearerToken?stringBearer token added as an Authorization header.
label?stringName for the request record (empty = a generated name). Also names a
saveBody?booleanStore the full response body as a `body` file resource.
outputFile?stringAlso write the response body to this path.
maxBodyBytes?numberOverride the global recorded-body cap for this request.
reuseCookies?booleanOverride the global reuseCookies for this request.
followRedirects?booleanOverride the global followRedirects for this request.
insecure?booleanOverride the global insecure for this request.
timeoutMs?numberOverride the global timeoutMs for this request.
failOnHttpError?booleanFail the run when the final status is 400+. The record is still written
failOnCurlError?booleanFail the run when curl exits non-zero. The record is still written
fn post(url: string, method?: string, headers?: array, query?: record, data?: string, dataJson?: unknown, dataFile?: string, form?: record, multipart?: record, files?: record, cookies?: array, user?: string, bearerToken?: string, label?: string, saveBody?: boolean, outputFile?: string, maxBodyBytes?: number, reuseCookies?: boolean, followRedirects?: boolean, insecure?: boolean, timeoutMs?: number, failOnHttpError?: boolean, failOnCurlError?: boolean)
Thin `request` wrapper that forces the POST method.
ArgumentTypeDescription
urlstringURL to request.
method?stringHTTP method. Empty = auto (POST when a body is supplied, otherwise GET).
headers?arrayExtra request headers, each as "Name: Value". Override globals.
query?recordQuery parameters appended to the URL.
data?stringRaw request body, sent byte-for-byte and recorded (truncated).
dataJson?unknownBody serialized as JSON; sets Content-Type: application/json.
dataFile?stringPath of a file to send as the body (curl --data-binary @file). The
form?recordForm fields sent as application/x-www-form-urlencoded.
multipart?recordMultipart form fields (curl --form name=value). Use for APIs that take
files?recordFiles attached as multipart fields (curl --form name=@path). Combine with
cookies?arrayCookies to send for this request, each as "name=value".
user?stringuser:password for HTTP basic auth (curl --user).
bearerToken?stringBearer token added as an Authorization header.
label?stringName for the request record (empty = a generated name). Also names a
saveBody?booleanStore the full response body as a `body` file resource.
outputFile?stringAlso write the response body to this path.
maxBodyBytes?numberOverride the global recorded-body cap for this request.
reuseCookies?booleanOverride the global reuseCookies for this request.
followRedirects?booleanOverride the global followRedirects for this request.
insecure?booleanOverride the global insecure for this request.
timeoutMs?numberOverride the global timeoutMs for this request.
failOnHttpError?booleanFail the run when the final status is 400+. The record is still written
failOnCurlError?booleanFail the run when curl exits non-zero. The record is still written
fn cookie-jar(clear?: boolean, raw?: boolean)
Report the cookies in the persistent jar (optionally the raw text),
ArgumentTypeDescription
clear?booleanDelete the cookie jar file after reporting its contents.
raw?booleanInclude the raw cookie jar text in the record.

Resources

request(infinite)— Full in/out record of one curl request: headers, cookies, body,
cookieJar(infinite)— Contents and state of the persistent cookie jar.

Files

body(application/octet-stream)— Full response body, stored when saveBody is set.
03Previous Versions2
2026.10.11.2
2026.10.11.1
04Stats
A
93 / 100
Downloads
33
Archive size
33.3 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit1/2partial
    • @std/assert--jsr:@std/assert@1 is a range; audited 1.0.19, the version the registry resolved
    1 dependency found
    • jsr:@std/assert@1 -- audited 1.0.19
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned

06Platforms