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

Function check_min_version_header

atomic-remote/src/version.rs:50–65  ·  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

48/// Prints a warning to stderr when an upgrade is needed. Silently does
49/// nothing if the header is absent, unparseable, or already satisfied.
50pub fn check_min_version_header(headers: &HeaderMap) {
51 let header_name = reqwest::header::HeaderName::from_static("x-atomic-min-version");
52
53 if let Some(val) = headers.get(&header_name) {
54 if let Ok(min_ver) = val.to_str() {
55 let current = crate::VERSION;
56 if needs_upgrade(current, min_ver) {
57 eprintln!(
58 "warning: this server requires Atomic CLI >= {} (you have {}). \
59 Run 'atomic update' to upgrade.",
60 min_ver, current
61 );
62 }
63 }
64 }
65}
66
67// ============================================================================
68// Tests

Callers 15

no_header_no_panicFunction · 0.85
deleteMethod · 0.85
handle_responseMethod · 0.85
get_chunk_manifestMethod · 0.85
sync_pushMethod · 0.85
sync_pullMethod · 0.85
get_stateMethod · 0.85
get_changelistMethod · 0.85
get_idMethod · 0.85

Calls 2

needs_upgradeFunction · 0.85
getMethod · 0.65

Tested by 2

no_header_no_panicFunction · 0.68