MCPcopy Create free account
hub / github.com/base/base / validate_endpoints

Method validate_endpoints

acceptance/src/runner.rs:477–500  ·  view source on GitHub ↗

Rejects missing roles and credential-bearing URLs before any network operation.

(config: &ScenarioConfig, endpoints: &EndpointMap)

Source from the content-addressed store, hash-verified

475
476 /// Rejects missing roles and credential-bearing URLs before any network operation.
477 pub fn validate_endpoints(config: &ScenarioConfig, endpoints: &EndpointMap) -> Result<()> {
478 for role in Self::required_roles(config) {
479 if !endpoints.contains_key(&role) {
480 bail!("required endpoint {role} missing");
481 }
482 }
483 for (role, url) in endpoints {
484 if !matches!(role.as_str(), "l1" | "builder" | "validator" | "rpc" | "shadow") {
485 bail!("unknown endpoint role");
486 }
487 let parsed =
488 reqwest::Url::parse(url).map_err(|_| eyre::eyre!("invalid URL for {role}"))?;
489 if !matches!(parsed.scheme(), "http" | "https")
490 || parsed.host_str().is_none()
491 || !parsed.username().is_empty()
492 || parsed.password().is_some()
493 || parsed.query().is_some()
494 || parsed.fragment().is_some()
495 {
496 bail!("{role} requires an HTTP URL without credentials, query, or fragment");
497 }
498 }
499 Ok(())
500 }
501
502 /// Builds a lifecycle stage without interpreting an error as an assertion failure.
503 pub fn stage(id: &str, status: Status, started: Instant, message: &str) -> StageResult {

Callers

nothing calls this directly

Calls 5

parseFunction · 0.85
is_someMethod · 0.80
contains_keyMethod · 0.45
is_emptyMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected