MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / read_min_version_header

Function read_min_version_header

atomic-remote/src/version.rs:37–43  ·  view source on GitHub ↗

Read the raw `X-Atomic-Min-Version` header value, if present and valid UTF-8. Returns `None` when the header is absent or its value cannot be decoded. Callers can use this to include the server's version in error messages.

(headers: &HeaderMap)

Source from the content-addressed store, hash-verified

35/// Returns `None` when the header is absent or its value cannot be decoded.
36/// Callers can use this to include the server's version in error messages.
37pub fn read_min_version_header(headers: &HeaderMap) -> Option<String> {
38 let header_name = reqwest::header::HeaderName::from_static("x-atomic-min-version");
39 headers
40 .get(&header_name)
41 .and_then(|v| v.to_str().ok())
42 .map(str::to_owned)
43}
44
45/// Check the `X-Atomic-Min-Version` response header and warn if the
46/// current CLI version is older than the server's minimum requirement.

Callers 1

sync_pullMethod · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected