Expand description
HTTP request and response helpers for Sentinel proxy
This module provides utilities for:
- Extracting request information from Pingora sessions
- Writing HTTP responses to Pingora sessions
- Trace ID extraction from headers
These helpers reduce boilerplate in the main proxy logic and ensure consistent handling of HTTP operations.
Functionsยง
- extract_
request_ info - Extract request info from a Pingora session
- get_
or_ create_ trace_ id - Extract or generate a trace ID from request headers
- get_
or_ create_ trace_ id_ default - Extract or generate a trace ID (convenience function using TinyFlake default)
- write_
error - Write an error response to a Pingora session
- write_
json_ error - Write a JSON error response
- write_
response - Write an HTTP response to a Pingora session
- write_
text_ error - Write a plain text error response