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

Function check_min_version_header

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

Check the `X-Atomic-Min-Version` response header and warn if the current CLI version is older than the server's minimum requirement. Prints a warning to stderr when an upgrade is needed. Silently does nothing if the header is absent, unparseable, or already satisfied.

(headers: &HeaderMap)

Source from the content-addressed store, hash-verified

36/// Prints a warning to stderr when an upgrade is needed. Silently does
37/// nothing if the header is absent, unparseable, or already satisfied.
38pub fn check_min_version_header(headers: &HeaderMap) {
39 let header_name = reqwest::header::HeaderName::from_static("x-atomic-min-version");
40
41 if let Some(val) = headers.get(&header_name) {
42 if let Ok(min_ver) = val.to_str() {
43 let current = crate::VERSION;
44 if needs_upgrade(current, min_ver) {
45 eprintln!(
46 "warning: this server requires Atomic CLI >= {} (you have {}). \
47 Run 'atomic update' to upgrade.",
48 min_ver, current
49 );
50 }
51 }
52 }
53}
54
55// ============================================================================
56// Tests

Callers 15

no_header_no_panicFunction · 0.85
deleteMethod · 0.85
handle_responseMethod · 0.85
get_chunk_manifestMethod · 0.85
get_stateMethod · 0.85
get_changelistMethod · 0.85
get_idMethod · 0.85
download_changeMethod · 0.85
download_tagMethod · 0.85

Calls 2

needs_upgradeFunction · 0.85
getMethod · 0.65

Tested by 2

no_header_no_panicFunction · 0.68