Skip to main content

fetch_page_html_raw_conditional

Function fetch_page_html_raw_conditional 

Source
pub async fn fetch_page_html_raw_conditional(
    target_url: &str,
    client: &Client,
    etag_cache: &ETagCache,
) -> PageResponse
Available on crate feature etag_cache only.
Expand description

Perform a conditional network request using cached ETag / Last-Modified validators.

If the server responds with 304 Not Modified, returns a page response with the original cached status (200) and empty body. The caller should use the previously cached content. The PageResponse.status_code is set to 304 so the caller can detect the not-modified case.

Also stores any new ETag / Last-Modified headers from 200 responses.