Skip to main content

HttpFetchFn

Type Alias HttpFetchFn 

Source
pub type HttpFetchFn = Box<dyn Fn(&Url, &HashMap<String, String>, Duration, bool) -> Result<Vec<Payload>, String> + Send + Sync + 'static>;
Expand description

The transport closure driving an Http loader — you implement the actual request here.

Called once per source with, in order:

  • &Url — the parsed resource URL.
  • &HashMap<String, String> — the validated headers option.
  • Duration — the timeout option; enforcing it is up to this closure.
  • bool — the insecure option (allow invalid TLS); honoring it is up to this closure.

Return one Payload per configuration entry fetched. On failure return an Err(String); the loader wraps it as Error::Load with description "fetch configuration". Names and formats on the returned payloads are normalized afterwards (trimmed, lower-cased per the lowercase option), so this closure may set them raw.

Must be Send + Sync + 'static so the loader can be shared across threads.

Aliased Type§

pub struct HttpFetchFn(/* private fields */);