Skip to main content

forward_request

Function forward_request 

Source
pub async fn forward_request(
    __arg0: State<ProxyState>,
    req: Request<Body>,
    upstream_base: &str,
    default_path: &str,
    compress_body: impl FnOnce(Value, usize) -> (Vec<u8>, usize, usize),
    provider_label: &str,
    extra_stream_types: &[&str],
) -> Result<Response, StatusCode>
Expand description

Transforms the already-parsed JSON request body (parsed once upstream, so the compressor never re-parses) into the serialized — possibly compressed — body, its original size, and its compressed size. A plain fn from the static providers or a closure that captures request-derived context (e.g. Gemini’s path-encoded model) both satisfy this bound.