Skip to content
Corex

EnvelopeResponder

Corex\Http\EnvelopeResponder · class · Core layer

The thin WordPress boundary for a {@see ResponseEnvelope} (spec 043). Maps the envelope’s machine code to an HTTP status and wraps the body as a WP_REST_Response. No business logic — greenfield endpoints call toRest(); endpoints that already own an authoritative status (e.g. the throttle-aware form submit) reuse status() / ResponseEnvelope::toArray() directly to preserve their own status.

HTTP status for an envelope: success → 200; validation → 422; forbidden → 403; any other error → 400.

toRest(ResponseEnvelope $envelope): WP_REST_Response

Section titled “toRest(ResponseEnvelope $envelope): WP_REST_Response”