Expand description
HTTP response and error-construction helpers shared across the request handler.
Kept separate from crate::handler so error-shape concerns (what does
a 400 vs 403 vs 502 body look like) are reviewable independently of
routing/business logic, and so the body-reading size-limit logic — which
has a non-obvious “did the connection error or did the body exceed the
limit” distinction — has room to be documented and tested on its own.
Enums§
- Body
Read Error - Why reading the request body failed.
Functions§
- classify_
upstream_ error - Classify a
guardrail_core::GuardrailError::Upstreaminto a coarse error class for theguardrail_upstream_errors_totalmetric label. - error_
body_ response - Wrap an arbitrary JSON value as a full HTTP response with the given status.
- error_
response - Build a standard error response body and wrap it as a full HTTP response.
- internal_
error_ response - A generic
500response for failures that have no more specific status. - read_
limited_ body - Read an incoming request body, enforcing
max_sizeas a byte ceiling.