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

Function form_url_encode

crates/openshell-supervisor-network/src/l7/rest.rs:970–985  ·  view source on GitHub ↗
(input: &str)

Source from the content-addressed store, hash-verified

968}
969
970fn form_url_encode(input: &str) -> String {
971 let mut encoded = String::with_capacity(input.len());
972 for byte in input.bytes() {
973 match byte {
974 b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'*' => {
975 encoded.push(byte as char);
976 }
977 b' ' => encoded.push('+'),
978 _ => {
979 use std::fmt::Write as _;
980 let _ = write!(encoded, "%{byte:02X}");
981 }
982 }
983 }
984 encoded
985}
986
987fn hex_value(byte: u8) -> Option<u8> {
988 match byte {

Callers 1

Calls 2

lenMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected