Skip to main content

Module http

Module http 

Source
Expand description

HTTP loader (http feature).

Fetches configuration bytes through a user-provided closure so this crate does not depend on any HTTP client library. You supply the actual transport (via Http::new); the loader validates options, invokes your closure, and normalizes the returned entries.

Source: http (the resource is the URL and is required; an empty resource is rejected with Error::InvalidResource)

§Behaviour

  • The headers, timeout, and insecure options are validated here, then passed to your fetch closure — enforcing them (timeouts, TLS policy) is the closure’s responsibility.
  • Whatever Payloads the closure returns are post-processed: maybe_name and maybe_format are trimmed, emptied to None, and lower-cased when lowercase = true (the default).
  • If the closure returns an error it is wrapped as Error::Load with description "fetch configuration".

§Options

  • headers — map of string headers (default {})
  • timeout — positive integer seconds (default 15)
  • insecure — allow invalid TLS certificates (default false)
  • lowercase — boolean (default true; whether to lowercase entry names and formats)

§Example

http(headers=(Authorization="TOKEN"),timeout=30,insecure=true):https://example.com/config.yml

Structs§

Http
Loader for the http source: fetches configuration bytes through a user-supplied closure.

Constants§

NAME
SOURCE

Type Aliases§

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