Skip to main content

Module cors

Module cors 

Source
Available on crate feature server only.
Expand description

CORS helpers for exposing x402 response headers to browser clients.

A browser-based buyer needs to read the Payment-Required and Payment-Response headers from cross-origin responses. That read is blocked by default unless the server explicitly advertises the headers via Access-Control-Expose-Headers. ensure_expose_headers merges the x402 entries into any existing value (idempotent).

Constants§

X402_EXPOSED_HEADERS
The canonical list of x402 response headers clients need to see.

Functions§

ensure_expose_headers
Ensures Access-Control-Expose-Headers on headers advertises the x402 response headers. Idempotent: calling more than once is a no-op.