rama-http-types 0.3.0-alpha.4

rama http type defintions and high level utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Opentelemetry utilities

use crate::Version;

/// Return the [`Version`] as the OTEL `network.protocol.version`.
///
/// Reference: <https://opentelemetry.io/docs/specs/semconv/registry/attributes/network/>
#[must_use]
pub fn version_as_protocol_version(version: Version) -> &'static str {
    match version {
        Version::HTTP_09 => "0.9",
        Version::HTTP_10 => "1.0",
        Version::HTTP_11 => "1.1",
        Version::HTTP_2 => "2",
        Version::HTTP_3 => "3",
        _ => "",
    }
}