Skip to main content

process_header_substitution

Function process_header_substitution 

Source
pub fn process_header_substitution<B>(
    value: &str,
    req: &Request<B>,
) -> Result<String>
Expand description

Process header value substitutions

Replaces placeholders in the header value with actual values:

  • {header.Name} - value of request header with that name
  • {uuid} - generates a random UUID
  • {env.VAR} - value of environment variable VAR

§Arguments

  • value - The header value template with placeholders
  • req - The HTTP request to extract headers from

§Returns

The processed header value with all placeholders replaced

§Example

let result = process_header_substitution("X-Request-ID: {uuid}", &req)?;
assert!(result.contains("X-Request-ID:"));