Skip to content

v0.9.1 — Cached body helper for HttpPlug

Choose a tag to compare

@azmaveth azmaveth released this 11 Apr 21:25
· 43 commits to master since this release

Patch release. Backwards compatible.

Added

HttpPlug: cached body support via conn.assigns[:raw_body] — Upstream plugs (e.g., signature-verification auth pipelines) can now pre-read the request body and stash it in conn.assigns[:raw_body]. The HTTP plug checks for a cached body before calling read_body/1, avoiding the empty-body issue that occurs when the underlying adapter has already been consumed by an upstream plug.

Backwards compatible: callers that don't pre-read the body see no change in behavior. The new helper falls through to read_body/1 when raw_body is absent.

Use case

Enables HTTP-authentication plugs that need to verify the body bytes (e.g., per-request request signing) before ExMCP processes the request, without forcing the auth plug to patch ExMCP, swap the conn adapter, or replace ExMCP.HttpPlug entirely.

The motivating use case is the Arbor project's SignedRequestAuth plug, which uses Ed25519 per-request signatures over method + path + body for external agent authentication. The plug pre-reads the body for signature verification, then relies on this helper to let ExMCP read the same bytes downstream.

Full diff

v0.9.0...v0.9.1