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)
| 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. |
| 37 | pub 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. |