Skip to main content

fetch_with_http_client

Function fetch_with_http_client 

Source
pub fn fetch_with_http_client(
    request: FetchRequest<'_>,
    services: FetchServices<'_>,
    http_client: Option<&dyn HttpClient>,
) -> Result<FetchOutcome>
Expand description

Like fetch, but drives the smart-HTTP transport through a caller-provided HttpClient when http_client is Some.

None is exactly fetch (a default UreqHttpClient). A Some client owns the entire dial (DNS→connect→TLS) for every smart-HTTP request, letting a host enforce network policy such as SSRF validation on the resolved IP. Only the HTTP transport consults the injected client; SSH/git/local sources ignore it.