feat: add 2025-11-25 protocol version support (#802)
This commit is contained in:
parent
4628720f89
commit
a64be23152
2 changed files with 16 additions and 4 deletions
|
|
@ -152,14 +152,19 @@ impl std::fmt::Display for ProtocolVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProtocolVersion {
|
impl ProtocolVersion {
|
||||||
|
pub const V_2025_11_25: Self = Self(Cow::Borrowed("2025-11-25"));
|
||||||
pub const V_2025_06_18: Self = Self(Cow::Borrowed("2025-06-18"));
|
pub const V_2025_06_18: Self = Self(Cow::Borrowed("2025-06-18"));
|
||||||
pub const V_2025_03_26: Self = Self(Cow::Borrowed("2025-03-26"));
|
pub const V_2025_03_26: Self = Self(Cow::Borrowed("2025-03-26"));
|
||||||
pub const V_2024_11_05: Self = Self(Cow::Borrowed("2024-11-05"));
|
pub const V_2024_11_05: Self = Self(Cow::Borrowed("2024-11-05"));
|
||||||
pub const LATEST: Self = Self::V_2025_06_18;
|
pub const LATEST: Self = Self::V_2025_11_25;
|
||||||
|
|
||||||
/// All protocol versions known to this SDK.
|
/// All protocol versions known to this SDK.
|
||||||
pub const KNOWN_VERSIONS: &[Self] =
|
pub const KNOWN_VERSIONS: &[Self] = &[
|
||||||
&[Self::V_2024_11_05, Self::V_2025_03_26, Self::V_2025_06_18];
|
Self::V_2024_11_05,
|
||||||
|
Self::V_2025_03_26,
|
||||||
|
Self::V_2025_06_18,
|
||||||
|
Self::V_2025_11_25,
|
||||||
|
];
|
||||||
|
|
||||||
/// Returns the string representation of this protocol version.
|
/// Returns the string representation of this protocol version.
|
||||||
pub fn as_str(&self) -> &str {
|
pub fn as_str(&self) -> &str {
|
||||||
|
|
@ -187,6 +192,7 @@ impl<'de> Deserialize<'de> for ProtocolVersion {
|
||||||
"2024-11-05" => return Ok(ProtocolVersion::V_2024_11_05),
|
"2024-11-05" => return Ok(ProtocolVersion::V_2024_11_05),
|
||||||
"2025-03-26" => return Ok(ProtocolVersion::V_2025_03_26),
|
"2025-03-26" => return Ok(ProtocolVersion::V_2025_03_26),
|
||||||
"2025-06-18" => return Ok(ProtocolVersion::V_2025_06_18),
|
"2025-06-18" => return Ok(ProtocolVersion::V_2025_06_18),
|
||||||
|
"2025-11-25" => return Ok(ProtocolVersion::V_2025_11_25),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
Ok(ProtocolVersion(Cow::Owned(s)))
|
Ok(ProtocolVersion(Cow::Owned(s)))
|
||||||
|
|
@ -3745,7 +3751,11 @@ mod tests {
|
||||||
fn test_protocol_version_order() {
|
fn test_protocol_version_order() {
|
||||||
let v1 = ProtocolVersion::V_2024_11_05;
|
let v1 = ProtocolVersion::V_2024_11_05;
|
||||||
let v2 = ProtocolVersion::V_2025_03_26;
|
let v2 = ProtocolVersion::V_2025_03_26;
|
||||||
|
let v3 = ProtocolVersion::V_2025_06_18;
|
||||||
|
let v4 = ProtocolVersion::V_2025_11_25;
|
||||||
assert!(v1 < v2);
|
assert!(v1 < v2);
|
||||||
|
assert!(v2 < v3);
|
||||||
|
assert!(v3 < v4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -866,14 +866,16 @@ async fn test_server_rejects_unsupported_protocol_version() {
|
||||||
fn test_protocol_version_utilities() {
|
fn test_protocol_version_utilities() {
|
||||||
use rmcp::model::ProtocolVersion;
|
use rmcp::model::ProtocolVersion;
|
||||||
|
|
||||||
|
assert_eq!(ProtocolVersion::V_2025_11_25.as_str(), "2025-11-25");
|
||||||
assert_eq!(ProtocolVersion::V_2025_06_18.as_str(), "2025-06-18");
|
assert_eq!(ProtocolVersion::V_2025_06_18.as_str(), "2025-06-18");
|
||||||
assert_eq!(ProtocolVersion::V_2025_03_26.as_str(), "2025-03-26");
|
assert_eq!(ProtocolVersion::V_2025_03_26.as_str(), "2025-03-26");
|
||||||
assert_eq!(ProtocolVersion::V_2024_11_05.as_str(), "2024-11-05");
|
assert_eq!(ProtocolVersion::V_2024_11_05.as_str(), "2024-11-05");
|
||||||
|
|
||||||
assert_eq!(ProtocolVersion::KNOWN_VERSIONS.len(), 3);
|
assert_eq!(ProtocolVersion::KNOWN_VERSIONS.len(), 4);
|
||||||
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2024_11_05));
|
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2024_11_05));
|
||||||
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2025_03_26));
|
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2025_03_26));
|
||||||
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2025_06_18));
|
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2025_06_18));
|
||||||
|
assert!(ProtocolVersion::KNOWN_VERSIONS.contains(&ProtocolVersion::V_2025_11_25));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Integration test: Verify server validates only the Host header for DNS rebinding protection
|
/// Integration test: Verify server validates only the Host header for DNS rebinding protection
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue