should_stream

Function should_stream 

Source
pub fn should_stream(
    policy: &StreamingPolicy,
    size_hint: &SizeHint,
    content_type: Option<&str>,
    content_length: Option<u64>,
) -> StreamingDecision
Expand description

Determines how to handle a response body based on size hints and content type.

This function implements the core streaming decision logic by examining:

  1. Whether streaming is enabled in the policy
  2. Content-Type header (fast path for exclusions/forced caching)
  3. Size hints from the body
  4. Content-Length header as fallback

§Arguments

  • policy - The streaming policy configuration
  • size_hint - Size hint from the response body
  • content_type - Content-Type header value, if present
  • content_length - Content-Length header value, if present

§Returns

A StreamingDecision indicating how to handle the body.