Decoy Getting started Docs GitLab Hub

Docs

Reference for the decoy command line, the control API, Rules, Handlers and the Decoy CA. To answer your first call, start with Getting started. Decoy is part of SlopKit. The source is at https://gitlab.techtailors.net/slopkit/decoy.

This page describes decoy 0.1.0, built from the source at commit 3171d82. Decoy has no published release yet. Option names, defaults and output below were checked against that source and against a local build.

Decoy is one binary that is a DNS server and an HTTP(S) proxy. It answers third-party traffic, for example api.stripe.com, with Rules registered at runtime, and records every call in the Call Journal. The application is not changed.

Terms

Intercepted Host
A hostname whose DNS answers and HTTP(S) traffic Decoy takes over. Every other hostname resolves and connects normally.
Rule
A registered behavior that matches intercepted requests by host, path, method and headers, and decides the response: a fixed answer or a Handler.
Handler
The code part of a Rule. A Workers-style module that receives a request and returns a response.
Rule Host
A process, running in the JavaScript runtime you choose, where Handlers run with npm package support.
Embedded Mode
Running Handlers inside Decoy itself, with no external runtime and no npm packages.
Unmatched Policy
What Decoy does with an intercepted request that no Rule matches: fail, passthrough or default. Set per Intercepted Host.
Call Journal
The record of every intercepted request and the response Decoy gave.
Proxy Mode
The client uses Decoy as an HTTP(S) proxy (HTTPS_PROXY). Intercepted Hosts are answered by Decoy. Other hosts are tunnelled untouched.
Transparent Mode
The client resolves an Intercepted Host through Decoy's DNS and connects straight to Decoy's TLS port. No proxy setting on the client.
Decoy CA
The certificate authority Decoy uses to answer HTTPS for Intercepted Hosts. Clients must trust it.
Setup Helper
A Decoy-provided way to point a client at Decoy and make it trust the Decoy CA: decoy run and decoy setup.

Command line

decoy [--state-dir DIR] <COMMAND>

decoy --version prints decoy 0.1.0. decoy <command> --help prints the options of one command.

CommandWhat it does
decoy serveRuns Decoy.
decoy ca export, decoy ca path, decoy ca bundleWorks with the Decoy CA.
decoy run -- COMMAND...Runs a command with the proxy and CA trust set up for Decoy.
decoy setup browser, docker, kubernetesPrints or writes configuration that points clients at Decoy.

Global option

--state-dir DIR
Directory that holds the Decoy CA. Accepted by every command. Environment variable: DECOY_STATE_DIR. Default: $DECOY_STATE_DIR, else $XDG_STATE_HOME/decoy, else ~/.local/state/decoy. See State directory.

decoy serve

decoy serve [OPTIONS]

Starts the control API, the DNS server, the explicit proxy and the transparent TLS listener, then runs until interrupted with Ctrl-C. Each listener has a default address on 127.0.0.1. On start it prints the addresses it uses to stderr:

decoy: control API   http://127.0.0.1:7411
decoy: DNS           127.0.0.1:5300 (udp+tcp), upstream 127.0.0.1:53
decoy: proxy         http://127.0.0.1:7412  (HTTPS_PROXY / HTTP_PROXY)
decoy: transparent   tls://127.0.0.1:7413
decoy: CA            <state-dir>/ca.pem

The upstream address in the DNS line is whatever resolver Decoy picked on your machine. A listener that is switched off is not printed. Log output uses the RUST_LOG filter and defaults to decoy=info.

Listeners

OptionEnvironment variableDefaultMeaning
--control-listen ADDRDECOY_CONTROL_LISTEN127.0.0.1:7411Control API. Keep it on localhost: it can change what Decoy answers.
--proxy-listen ADDRDECOY_PROXY_LISTEN127.0.0.1:7412Explicit proxy (HTTP proxy and CONNECT). Use with HTTPS_PROXY.
--tls-listen ADDRDECOY_TLS_LISTEN127.0.0.1:7413Transparent TLS. Clients that resolve an Intercepted Host through Decoy's DNS connect here, and the SNI picks the host. Use port 443 where clients expect it.
--dns-listen ADDRDECOY_DNS_LISTEN127.0.0.1:5300DNS, UDP and TCP.
--http-listen ADDRDECOY_HTTP_LISTENoffTransparent plain HTTP, routed by the Host header.
--no-dnsSwitch off the DNS server.
--no-proxySwitch off the explicit proxy.
--no-tlsSwitch off the transparent TLS listener.

ADDR is a socket address such as 127.0.0.1:7411.

DNS and passthrough

OptionEnvironment variableDefaultMeaning
--dns-answer IPDECOY_DNS_ANSWER127.0.0.1Address Intercepted Hosts resolve to: an A record for IPv4, an AAAA record for IPv6. Repeatable, or comma-separated in the environment variable.
--dns-ttl SECONDS1TTL of the DNS answers for Intercepted Hosts.
--upstream-dns ADDRDECOY_UPSTREAM_DNSfirst nameserver in /etc/resolv.conf that is not Decoy itself, else 1.1.1.1:53Resolver for every other name, and for reaching real hosts in passthrough.
--upstream-ca FILEnoneExtra root certificate (PEM file) to trust when talking to real services. Repeatable.
--transparent-https-port PORT443Real port behind a transparent TLS connection (the passthrough target).
--transparent-http-port PORT80Real port behind a transparent HTTP connection (the passthrough target).
--upstream-timeout SECONDS30Time before connecting to or hearing from a real service times out.

Bodies and the Call Journal

OptionDefaultMeaning
--journal-capacity N10000Number of calls the Call Journal keeps. The oldest are dropped first.
--max-body BYTES16777216 (16 MiB)Largest request body accepted. Larger requests get 413 and are journaled.
--journal-body BYTES1048576 (1 MiB)Bytes of each body kept in the Call Journal.

Handlers

OptionEnvironment variableDefaultMeaning
--rule-host COMMANDDECOY_RULE_HOSTnodeCommand that starts the Rule Host's JavaScript runtime, for example node, bun or deno run -A. Split on whitespace. An empty value is refused.
--handler-mode MODEDECOY_HANDLER_MODEhostWhere Handlers run unless the Rule says otherwise: host (Rule Host) or embedded (Embedded Mode).

Hosts at startup

--intercept HOST[=POLICY]
Registers an Intercepted Host when Decoy starts. POLICY is fail, passthrough or default. Without it the policy is fail. Repeatable. Any other policy value stops Decoy with an error. Hosts can also be added later through the control API.
decoy serve --intercept api.stripe.com --intercept '*.example.com=passthrough'

decoy ca

decoy ca export [-o FILE]
decoy ca path
decoy ca bundle
decoy ca export
Prints the Decoy CA certificate as PEM to stdout. -o FILE (--out FILE) writes it to a file instead. Creates the CA on first use.
decoy ca path
Prints the path of ca.pem in the state directory. Creates the CA on first use.
decoy ca bundle
Writes public roots plus the Decoy CA as one PEM bundle at <state-dir>/ca-bundle.pem and prints its path to stdout. It prints the source of the public roots to stderr (decoy: public roots from <file>). Fails with a message if it finds no public roots. This is the file that SSL_CERT_FILE must point at.

A running Decoy also serves the CA at GET /ca and GET /ca.pem on the control API.

decoy run

decoy run [--proxy URL] [--control URL] -- COMMAND...

Starts COMMAND with the proxy and trust environment, replacing the decoy process. The exit code, signals and stdio are the command's own. COMMAND is required.

--proxy URL
Decoy's explicit proxy. Environment variable: DECOY_PROXY. Default: http://127.0.0.1:7412.
--control URL
Decoy's control API. The CA is read from it while it runs, and from the state directory otherwise. Environment variable: DECOY_CONTROL. Default: http://127.0.0.1:7411.

Decoy prints a warning to stderr when nothing listens at the proxy address and starts the command anyway.

The command gets these environment variables:

VariableValue
HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxyThe proxy URL.
NO_PROXY, no_proxyYour own value, plus localhost,127.0.0.1,::1.
NODE_USE_ENV_PROXY1. Node 24 ignores HTTPS_PROXY for fetch without it.
SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO, AWS_CA_BUNDLE, PIP_CERT, CARGO_HTTP_CAINFO, NPM_CONFIG_CAFILEThe bundle: public roots plus the Decoy CA (<state-dir>/ca-bundle.pem, rewritten on every run).
NODE_EXTRA_CA_CERTS, DENO_CERTThe Decoy CA alone (<state-dir>/client-ca.pem). These add to the client's own roots.

The public roots come from the first of these that exists: SSL_CERT_FILE, NIX_SSL_CERT_FILE, /etc/ssl/certs/ca-certificates.crt, /etc/pki/tls/certs/ca-bundle.crt, /etc/ssl/ca-bundle.pem, /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem, /etc/ssl/cert.pem, and a few more. If none exists, Decoy uses the platform trust store, and fails with a message if that has none.

SSL_CERT_FILE replaces the client's roots. That is why it names a bundle and not the Decoy CA alone: with the CA alone, every other HTTPS host fails.

decoy setup

All three subcommands read the CA from the running Decoy at --control and fall back to the state directory.

Shared options:

OptionEnvironment variableDefaultMeaning
--proxy URLDECOY_PROXYdepends on the subcommandDecoy's explicit proxy as the client will reach it.
--control URLDECOY_CONTROLhttp://127.0.0.1:7411Decoy's control API.

decoy setup browser

decoy setup browser [--format FORMAT]

Prints proxy and CA settings to stdout. The default --proxy is http://127.0.0.1:7412. It also writes <state-dir>/client-ca.pem.

--format FORMAT
One of flags (default), agent-browser or agent-browser-env.
FormatOutput
flagsChromium flags: --proxy-server=<proxy>, --proxy-bypass-list=<-loopback> and --ignore-certificate-errors-spki-list=<base64 SHA-256 of the Decoy CA's public key>.
agent-browser--proxy <proxy> --ca-cert <path to client-ca.pem>
agent-browser-envAGENT_BROWSER_PROXY=<proxy> and AGENT_BROWSER_CA_CERT=<path to client-ca.pem>, one per line.

With flags, Chromium accepts certificates that chain to the Decoy CA without the CA being installed in the NSS store. <-loopback> makes requests to localhost go through the proxy too: drop it to reach a local app directly. With flags, Decoy prints a note to stderr that other browsers need client-ca.pem imported. For Firefox or a system-wide install, import that file yourself.

decoy setup docker

decoy setup docker [--service NAME]... [--out DIR]

Writes ca.pem, ca-bundle.pem and compose.decoy.yaml into --out, and prints the docker compose command to run. The default --proxy is http://host.docker.internal:7412.

--service NAME
A Compose service to configure. Repeatable. Default: app.
--out DIR
Directory for the generated files. Default: decoy-docker.

For each named service the override sets the same proxy and trust variables as decoy run, with the two files mounted read-only at /etc/decoy/ (ca.pem and ca-bundle.pem), and adds host.docker.internal:host-gateway to extra_hosts so the name resolves on Linux. Start Decoy with --proxy-listen 0.0.0.0:7412 so containers can reach it.

decoy setup kubernetes

decoy setup kubernetes [--namespace NAME] [--name PREFIX]

Prints two ConfigMaps as YAML to stdout, ready for kubectl apply -f -. The default --proxy is http://decoy.<namespace>.svc:7412.

--namespace NAME
Namespace of the ConfigMaps. Default: default.
--name PREFIX
Name prefix of the ConfigMaps. Default: decoy.

The ConfigMap <PREFIX>-ca holds ca.pem and ca-bundle.pem. The ConfigMap <PREFIX>-env holds the variables, with file paths under /etc/decoy. The header comment of the output shows the envFrom and volume to add to a pod spec. Running Decoy in the cluster is up to your deployment: the proxy URL is the only link. A ConfigMap is limited to 1 MiB, and a bundle of public roots is about 200 KB.

State directory

The state directory holds the Decoy CA. It is the only state Decoy persists. Rules, hosts and the Call Journal live in memory and are gone when Decoy stops.

FileWritten byContent
ca.pemfirst use of the CAThe Decoy CA certificate.
ca-key.pemfirst use of the CAThe CA private key, mode 0600. It never leaves this directory.
ca-bundle.pemdecoy ca bundle, decoy run, decoy setup docker, decoy setup kubernetesPublic roots plus the Decoy CA.
client-ca.pemdecoy run, decoy setup browserA copy of the CA that clients are pointed at. It is not ca.pem, because the CA in use may belong to a Decoy with another state directory.
rule-host.mjsthe first Handler requestThe Rule Host script, compiled into the Decoy binary.

The CA is generated on first use (ECDSA P-256, self-signed) and reloaded on every start, so an exported CA stays valid across restarts. Decoy mints a leaf certificate per SNI, only for Intercepted Hosts. Do not trust this CA outside test environments.

Reaching Decoy

Proxy Mode
Point the client at --proxy-listen. Intercepted Hosts are answered by Decoy. Every other host is tunnelled to the real destination untouched. Plain HTTP requests and CONNECT are both accepted.
Transparent Mode
Use Decoy as the client's resolver. Intercepted Hosts resolve to the --dns-answer address, so the client connects to --tls-listen (or --http-listen for plain HTTP). Everything else is forwarded to --upstream-dns. For Intercepted Hosts, other record types (AAAA when there is no IPv6 answer, HTTPS and SVCB) are answered empty, so clients cannot find the real address. Run Decoy with --tls-listen 0.0.0.0:443 --dns-listen 0.0.0.0:53, or forward the ports, and set --dns-answer to an address that clients can reach.

Trusting the Decoy CA

Clients must trust the Decoy CA for HTTPS to Intercepted Hosts. decoy run and the other Setup Helpers do this for the clients they cover. By hand:

ClientTrust the CA with
curl, OpenSSL, Python requests, Go, RubySSL_CERT_FILE=$(decoy ca bundle), or REQUESTS_CA_BUNDLE or CURL_CA_BUNDLE. --cacert ca.pem works for a single call.
NodeNODE_EXTRA_CA_CERTS=<ca.pem>. With Node 24, also set NODE_USE_ENV_PROXY=1 so fetch honors HTTPS_PROXY.
BunNODE_EXTRA_CA_CERTS=<ca.pem> or SSL_CERT_FILE=<bundle>.
JavaImport the CA into a trust store with keytool -importcert.
Rust reqwest with webpki-rootsAdd the CA with add_root_certificate. This client ignores the environment.

Clients that pin certificates, or ignore the system trust store, reject Decoy's certificates.

Control API

JSON over HTTP on --control-listen (default 127.0.0.1:7411). It can change what Decoy answers, and it has no authentication in this version: keep it on localhost, or inside the pod.

Errors are {"error": "..."} with one of these statuses:

StatusMeaning
400Malformed query, or DELETE /rules without a filter.
404Unknown id or host.
422A body that parses but is invalid, for example a Rule for a host that is not intercepted.
501A Rule with a handler, on a Decoy with no Handler runtime.
EndpointPurpose
GET /health{"status":"ok"}
GET /info{"version": "...", "listeners": {...}}: the version and the addresses Decoy listens on. A listener that is off is null.
GET /ca, GET /ca.pemThe Decoy CA certificate, PEM (application/x-pem-file).
GET /hosts, POST /hostsList or add Intercepted Hosts.
GET /hosts/{name}, PUT /hosts/{name}, DELETE /hosts/{name}Read, upsert or remove one.
GET /rules, POST /rules, DELETE /rulesList, create or bulk delete Rules.
GET /rules/{id}, DELETE /rules/{id}Read or delete one Rule.
GET /calls, DELETE /calls, GET /calls/{id}Query or clear the Call Journal, or read one call.
POST /resetDelete every Rule and clear the Call Journal. Hosts stay. Answers {"rules_removed": n, "calls_removed": n}.

Intercepted hosts

POST /hosts
{ "name": "api.stripe.com", "unmatched": "fail" }
name
Required. A host name, lowercased by Decoy. *.example.com covers every name below example.com, but not example.com itself. IP addresses cannot be Intercepted Hosts.
unmatched
Optional. The Unmatched Policy, as a shorthand string or an object. Default: fail.

POST /hosts answers 201 with the host, or 200 when the host already existed and only its policy changed. PUT /hosts/{name} does the same with the name in the path and an optional {"unmatched": ...} body. GET /hosts answers {"hosts": [...]}.

DELETE /hosts/{name} removes the host and every Rule scoped to exactly that name, and answers {"removed": "<name>", "rules_removed": n}. DNS stops answering for it at once. Clients that cached the answer keep Decoy's address until the TTL (--dns-ttl, default 1 second) runs out.

Unmatched Policy

What Decoy does with an intercepted request that no Rule matches.

PolicyBehavior
{"policy":"fail"}Answer 502 with a JSON body that names the host, method and path and says how to fix it. {"policy":"fail","status":501} picks another 4xx or 5xx status.
{"policy":"passthrough"}Forward the request to the real host and relay its answer.
{"policy":"default","response":{...}}Answer with the canned response, in the same shape as a Rule's respond. Without response: 200 with {}.

The strings "fail", "passthrough" and "default" are accepted wherever a policy is.

Passthrough resolves the real address through --upstream-dns, never through Decoy's own DNS, so it cannot loop. In Proxy Mode it connects to the CONNECT target's port. In Transparent Mode it connects to --transparent-https-port or --transparent-http-port. It verifies the real service's certificate against the platform trust store plus any --upstream-ca files. If the real service is unreachable, the answer is a 502 whose body says why, and the Call Journal entry carries the same text in error.

Rules

POST /rules
{
  "label": "scenario-42",
  "host": "api.stripe.com",
  "method": "POST",
  "path": { "prefix": "/v1/payment_intents" },
  "headers": [ { "name": "baggage", "contains": "scenario=42" } ],
  "priority": 0,
  "respond": {
    "status": 402,
    "headers": { "x-request-id": "req_123" },
    "json": { "error": { "code": "card_declined" } },
    "delay_ms": 150
  }
}

The call answers 201 with the Rule, including id (r1, r2, and so on), created_at and hits. A JSON array of Rules creates all of them or none, and answers 201 {"rules": [...]}.

FieldMeaning
labelFree text. Groups Rules so they can be deleted together, for example one label per scenario.
hostAn Intercepted Host name or wildcard entry that is already registered, else 422. Omit it to match every Intercepted Host.
methodOne method or a list, case-insensitive. Omit for any.
path{"exact": "/a"}, {"prefix": "/a/"} or {"glob": "/a/*/b"}. It matches the path without the query. exact and prefix must start with /. A glob must start with / or *. Omit for any.
headersA list of conditions that must all hold. {"name": "x"} requires the header. equals compares the whole value. contains is a substring match, which suits baggage. Names are case-insensitive.
priorityInteger. Default: 0.
respondThe declarative answer. See below.
handlerCode that computes the answer. See Handlers.

Exactly one of respond and handler is required. A field that is not listed is refused with 422.

In a glob, * stays within one path segment, ** crosses segments and ? is one character within a segment.

Which Rule answers

Among all Rules that match, the highest priority wins. Among equals, the newest wins. A later Rule therefore overrides an earlier one without deleting it. Delete it, or its label, to go back.

respond

FieldMeaning
statusDefault: 200. 1xx is refused.
headersObject of name to string, or to a list of strings for several values such as set-cookie.
bodyUTF-8 text.
body_base64Binary body, base64.
jsonAny JSON value. Sent as the body, with content-type: application/json unless you set a content type.
delay_msMilliseconds to wait before answering.

At most one of body, body_base64 and json. Decoy adds x-decoy-outcome to every answer it gives, with the value rule, fail, passthrough or default. When a Rule answered, it also adds x-decoy-rule: <id>.

Listing and deleting

Call Journal

Every intercepted request and the answer Decoy gave. Traffic that was only tunnelled, such as a CONNECT to a host that is not intercepted, is not journaled. The journal keeps the newest --journal-capacity calls.

GET /calls?host=api.stripe.com&header=baggage:scenario=42&since=2026-12-01T10:00:00Z

The answer is {"count": n, "calls": [...]}. Each call looks like this:

{
  "id": "c17", "seq": 17,
  "time": "2026-12-01T10:00:03.412Z",
  "mode": "proxy", "scheme": "https",
  "host": "api.stripe.com", "method": "POST",
  "path": "/v1/payment_intents", "query": "expand=x",
  "request":  { "headers": { "baggage": "scenario=42" }, "body": "amount=100", "body_size": 10 },
  "response": { "status": 402, "headers": { "content-type": "application/json", "x-decoy-rule": "r3" },
                "body": "{\"error\":...}", "body_size": 41 },
  "rule_id": "r3",
  "outcome": "rule",
  "duration_ms": 151
}
mode
proxy for explicit proxy traffic (CONNECT or absolute-form requests), transparent for traffic that arrived through Decoy's DNS answer.
host
The CONNECT target in Proxy Mode. The SNI in Transparent Mode, or the Host header for plain HTTP.
outcome
rule, or the Unmatched Policy applied: fail, passthrough or default.
rule_id
null unless a Rule answered.
error
Present when a passthrough or a Handler failed.
seq
Calls are numbered in arrival order, even when a slow call finishes after a later fast one.

Header names are lowercased, and repeated headers are joined with , . A body appears as body (UTF-8 text) or body_base64 (binary), plus body_size. When it was cut at --journal-body bytes, body_truncated is true.

Filters

GET /calls and DELETE /calls take these query parameters. All filters are combined with AND.

ParameterMeaning
host, methodMatch that host or method.
pathExact path.
path_prefixPath prefix.
ruleRule id.
outcomerule, fail, passthrough or default.
header=name:substringRequest header contains the substring. Repeatable. header=name only requires the header.
sinceRFC 3339 timestamp or Unix milliseconds.
afterA seq or an id such as c17. Returns only later calls: a cursor for what happened since you last looked.
limitDefault 1000. The newest limit matches are returned, oldest first. GET only.
bodies=falseLeave bodies out. GET only.

GET /calls/{id} returns one call, by c17 or 17. DELETE /calls clears the journal, or only the calls that match the filters, and answers {"removed": n}.

Handlers

A Rule answered by code has a handler instead of respond:

POST /rules
{ "host": "api.stripe.com", "path": {"prefix": "/v1/"},
  "handler": { "module": "handlers/stripe.ts", "env": { "decline": true }, "mode": "host" } }
module
Required. Path to the Handler file. A relative path is resolved from Decoy's working directory. The file must exist when the Rule is registered, else 422. Editing the file takes effect on the next request.
env
Optional JSON object passed to the Handler.
mode
Optional. host or embedded. Default: the --handler-mode of the running Decoy.

A Handler is a Workers-style module with a default export:

import type { Handler } from "@slopkit/decoy";

export default {
  async fetch(request, env) {
    const order = await request.json();
    return Response.json({ id: "pi_1", amount: order.amount }, { status: 402 });
  },
} satisfies Handler;
request
A standard Request. Its URL is scheme://host/path?query as the client called it.
env
The Rule's handler.env, plus env.decoy = { ruleId, host }.

A Handler that throws, returns something that is not a Response, or cannot be loaded makes Decoy answer 502. The Call Journal entry has outcome: "rule" and the message in error. A missing runtime command shows up the same way, with a message that starts starting Rule Host. Handler answers are journaled like any other.

Rule Host

The default mode. Decoy starts the Rule Host in the runtime from --rule-host on the first Handler request, and restarts it if it dies. Handlers run in that runtime, so npm imports work. They resolve from the Handler file's location. TypeScript runs as is on Node 24 (type stripping), Bun and Deno. A Handler that does not answer within 30 seconds fails with 502.

The host script is packages/decoy/host.mjs in the source. It is compiled into the Decoy binary and written to <state-dir>/rule-host.mjs. The protocol is JSON-RPC 2.0 over the host's stdin and stdout, one JSON object per line, version 0.1. protocolVersion is major.minor: both sides refuse to talk when the major versions differ. Decoy calls these methods:

MethodParamsResult
initialize{ protocolVersion }{ protocolVersion, runtime }
handler.load{ module }null. Imports the module and checks its default export.
handler.fetch{ module, env, request }{ status, headers: [[name, value]], bodyBase64 }
shutdownnullnull, then the host exits.

request is { ruleId, host, url, method, headers: [[name, value]], bodyBase64 }. Bodies are buffered. The host's stderr is passed through, and the host sends console.log to stderr.

Embedded Mode

--handler-mode embedded, or "mode": "embedded" on a Rule, runs the Handler inside Decoy. swc strips the TypeScript and QuickJS runs the JavaScript. No Node, Bun or Deno is needed. The same source runs in either mode as long as it stays inside these limits.

A Handler is compiled when its Rule is registered: a syntax error or an unsupported import is refused with 422. Each request runs in a fresh QuickJS runtime, so Handlers share no state.

Supported:

Not supported:

Errors answer 502 and appear in the Call Journal's error, as in the Rule Host.

@slopkit/decoy package

@slopkit/decoy 0.1.0 holds the Handler types and the Rule Host script. It is in packages/decoy in the source, and this reference does not cover an install from a registry. It exports:

Handler
Interface with fetch(request: Request, env: Env): Response | Promise<Response>.
Env
{ decoy: { ruleId: string; host: string }; [key: string]: unknown }.
defineHandler(handler)
Returns its argument. It only gives editors the types. Nothing needs importing at run time.
PROTOCOL_VERSION
The Rule Host protocol version the package speaks: "0.1".

Limits