Exercises every route against a running server using the bundled client,
so the request/response path can be checked without the HTTP bridge.
Covers /hello with and without a name, percent- and plus-encoded query
values, text and JSON POST bodies, and the 4.00/4.04/4.05 error paths.
/health is matched by shape rather than an exact string since uptime
moves. Exits non-zero on failure; COAP_HOST/COAP_PORT retarget it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Browsers speak HTTP over TCP and cannot open coap:// URLs, which made the
server awkward to try without the CLI client. The bridge accepts an ordinary
HTTP request, reissues it as CoAP over UDP, and maps the response code back
onto an HTTP status (the raw code is also returned in X-Coap-Code).
It serves a test console at / with a name field and a button per route, so
GET, POST, 4.04 and 4.05 can all be exercised by clicking.
The CoAP request logic moves from src/bin/client.rs into src/lib.rs so the
client and the bridge share one implementation.
The bridge is a development convenience: a small HTTP/1.1 subset with no
keep-alive, chunked bodies or TLS.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A minimal CoAP (RFC 7252) server built on coap-lite for message encoding
and a tokio UdpSocket for transport. The socket, read loop and routing are
kept in src/main.rs rather than behind a framework.
Routes:
GET /hello[?name=X] -> 2.05 "Hello, X!" (defaults to World)
POST /hello -> 2.01, name from a raw text or JSON body
GET /health -> 2.05 status + uptime
Unknown paths return 4.04, known paths with the wrong method 4.05.
Includes a CLI client (src/bin/client.rs) for smoke tests and unit tests
covering the greeting, payload parsing and query decoding. Verified against
node-coap as an independent implementation to confirm wire compatibility.
The earlier Node.js prototype is kept under nodejs/ for reference.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>