Skip to content

PolicyInput

Defined in: src/core/protocol.ts:69

Protocol-agnostic view of what’s being processed.

Constructed by each runtime from its native message type:

  • HTTP runtime builds it from Hono’s Context
  • ext_proc runtime builds it from gRPC ProcessingRequest
  • WebSocket runtime builds it from the upgrade request or message frame

attributes: Map<string, unknown>

Defined in: src/core/protocol.ts:127

Cross-policy attribute bag.

Policies read attributes set by upstream policies and set attributes for downstream policies via AttributeMutation. Runtime-populated attributes use the runtime.* namespace (e.g. runtime.matched_route, runtime.upstream_name).


optional body: string | ArrayBuffer

Defined in: src/core/protocol.ts:109

Message body, present only during body phases.

May be the full buffered body or a streaming chunk, depending on the runtime’s buffering mode.


optional clientIp: string

Defined in: src/core/protocol.ts:101

Client IP address, extracted by the runtime from protocol-specific sources (e.g. CF-Connecting-IP, X-Forwarded-For, gRPC peer address).


headers: Headers

Defined in: src/core/protocol.ts:95

Headers (HTTP) or metadata (gRPC).

Treat as read-only - express modifications via PolicyResult mutations, not by mutating this object.


method: string

Defined in: src/core/protocol.ts:79

Request method or action.

  • HTTP: "GET", "POST", etc.
  • gRPC: Full method name, e.g. "users.UserService/GetUser"

path: string

Defined in: src/core/protocol.ts:87

Request path or resource identifier.

  • HTTP: URL path, e.g. "/users/123"
  • gRPC: Service path, e.g. "/users.UserService/GetUser"

phase: ProcessingPhase

Defined in: src/core/protocol.ts:71

Current processing phase.


protocol: ProtocolType

Defined in: src/core/protocol.ts:130

The protocol runtime that constructed this input.


optional trailers: Headers

Defined in: src/core/protocol.ts:117

Trailers, present only during trailer phases.

Relevant for gRPC (which uses trailers for status codes and error details) and HTTP/2.