Skip to main content

ModifyRequestFn

Type Alias ModifyRequestFn 

Source
pub type ModifyRequestFn = Arc<dyn Fn(&str, &Authority, &mut RequestMutation) + Send + Sync>;
Expand description

A function that mutates an outgoing request’s headers and/or body before it is sent, e.g. to inject a secret or authentication header.

Called with the request’s scheme and authority (host and port), the same context ValidateFn gets, so a single HttpAcl shared across multiple hosts can scope what it injects to a specific destination rather than leaking it to every host the ACL allows.

A ModifyRequestFn is attached via HttpAclBuilder::build_full or HttpAclBuilder::try_build_full (as part of an HttpAclHooks) rather than a dedicated builder setter, for the same reason ValidateFn is: it typically captures state from outside the builder.

Aliased Type§

pub struct ModifyRequestFn { /* private fields */ }