MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / to_display_string

Method to_display_string

crates/openshell-ocsf/src/objects/http.rs:65–76  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

63 /// (443 for `https`, 80 for `http`).
64 #[must_use]
65 pub fn to_display_string(&self) -> String {
66 let scheme = self.scheme.as_deref().unwrap_or("https");
67 let hostname = self.hostname.as_deref().unwrap_or("unknown");
68 let path = self.path.as_deref().unwrap_or("/");
69 let port_suffix = match self.port {
70 Some(443) if scheme == "https" => String::new(),
71 Some(80) if scheme == "http" => String::new(),
72 Some(p) => format!(":{p}"),
73 None => String::new(),
74 };
75 format!("{scheme}://{hostname}{port_suffix}{path}")
76 }
77}
78
79impl HttpRequest {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected