pub fn assumed_version(
header: Option<&str>,
signal: Option<ProtocolVersion>,
) -> ProtocolVersionExpand description
The version a request is assumed to be, given whatever signals it carries.
signal is the session’s negotiated version, or the _meta version on a
stateless request. header is the HTTP header. The session wins: a header
that disagreed with the session would already have been rejected by
check_protocol_header, and a session is a stronger statement of intent
than a header.
With neither, the request is assumed to be
assumed_version_without_signal.
§Examples
use protocol_droid::domain::{ProtocolVersion, assumed_version};
// Nothing to go on at all.
assert_eq!(assumed_version(None, None), ProtocolVersion::V2025_03_26);
// A header beats the fallback.
assert_eq!(
assumed_version(Some("2025-11-25"), None),
ProtocolVersion::V2025_11_25,
);