Skip to main content

load_answers

Function load_answers 

Source
pub fn load_answers(
    answers: &BTreeMap<String, String>,
) -> Result<BTreeMap<String, String>, ConfigError>
Expand description

Load every per-status template referenced by answers.

answers maps an HTTP status code (e.g. "503") to either a filesystem path or an inline:<body> literal — see resolve_answer_source for the resolution rules. Each entry is resolved into a body string and inserted into the returned map under the same key, ready to be assigned to the proto-level answers field on a HttpListenerConfig / HttpsListenerConfig / Cluster. Empty values are skipped (treated as “preserve current”) so the caller can use them as a no-op stub in example configs.

Errors map to the existing ConfigError::FileOpen / ConfigError::FileRead variants so the operator gets the same diagnostics whether the path comes from this map or from the deprecated per-status answer_301..answer_507 fields.