Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

19 linesCodeBlameRaw
1//! REST versions use a header, leaving GitHub-compatible URLs unprefixed.
2pub const HEADER: &str = "x-g1t-api-version";
3pub const CURRENT: &str = "1";
4
5pub fn supported(value: Option<&str>) -> bool {
6 value.is_none_or(|value| value.trim() == CURRENT)
7}
8
9#[cfg(test)]
10mod tests {
11 use super::*;
12 #[test]
13 fn omitted_versions_keep_working_and_unknown_versions_are_not_silently_accepted() {
14 assert!(supported(None));
15 assert!(supported(Some("1")));
16 assert!(supported(Some(" 1 ")));
17 for value in ["", "2", "latest", "1, 2"] { assert!(!supported(Some(value))); }
18 }
19}