Skip to main content

apply_conditional

Function apply_conditional 

Source
pub fn apply_conditional(
    request_headers: &[(String, Vec<u8>)],
    method: &Method,
    response: Response,
) -> Response
Expand description

Evaluate conditional request headers against a response and return the appropriate response (304, 412, or the original).

This checks If-None-Match (for GET/HEAD) and If-Match (for PUT/PATCH/DELETE) against the response’s ETag header.

§Arguments

  • request_headers - Iterator of (name, value) pairs from the request
  • method - The HTTP method
  • response - The prepared response (must have ETag header set)

§Returns

Either the original response or a 304/412 response as appropriate.