Skip to content

ccproxy.services.handler_config

ccproxy.services.handler_config

Handler configuration for request handling.

PluginTransformerProtocol

Bases: Protocol

Protocol for plugin-based transformers with header and body methods.

transform_headers

transform_headers(headers, *args, **kwargs)

Transform request headers.

Source code in ccproxy/services/handler_config.py
def transform_headers(
    self, headers: dict[str, str], *args: Any, **kwargs: Any
) -> dict[str, str]:
    """Transform request headers."""
    ...

SSEParserProtocol

Bases: Protocol

Protocol for SSE parsers to extract a final JSON response.

Implementations should return a parsed dict for the final response, or None if no final response could be determined.

transform_body

transform_body(body)

Transform request body.

Source code in ccproxy/services/handler_config.py
def transform_body(self, body: Any) -> Any:
    """Transform request body."""
    ...

HandlerConfig dataclass

HandlerConfig(
    request_adapter=None,
    response_adapter=None,
    request_transformer=None,
    response_transformer=None,
    supports_streaming=True,
    preserve_header_case=False,
    sse_parser=None,
    format_context=None,
)

Processing pipeline configuration for HTTP/streaming handlers.

This config only contains universal processing concerns, not plugin-specific parameters like session_id or access_token.

Following the Parameter Object pattern, this groups related processing components while maintaining clean separation of concerns. Plugin-specific parameters should be passed directly as method parameters.