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

Function url_encode

crates/openshell-driver-podman/src/client.rs:748–757  ·  view source on GitHub ↗

Minimal percent-encoding for query parameter values. Note: `percent-encoding` is available as a transitive dependency but is not a direct dependency of this crate. Rather than adding a new dep for one call site, we keep this self-contained implementation.

(s: &str)

Source from the content-addressed store, hash-verified

746/// a direct dependency of this crate. Rather than adding a new dep for one
747/// call site, we keep this self-contained implementation.
748fn url_encode(s: &str) -> String {
749 s.bytes()
750 .map(|b| match b {
751 b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => {
752 String::from(b as char)
753 }
754 _ => format!("%{b:02X}"),
755 })
756 .collect()
757}
758
759#[cfg(test)]
760mod tests {

Callers 3

list_containersMethod · 0.85
network_gateway_ipMethod · 0.85
events_streamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected