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

Function parse_query_params

crates/openshell-supervisor-network/src/l7/rest.rs:281–302  ·  view source on GitHub ↗
(query: &str)

Source from the content-addressed store, hash-verified

279}
280
281pub(crate) fn parse_query_params(query: &str) -> Result<HashMap<String, Vec<String>>> {
282 let mut params: HashMap<String, Vec<String>> = HashMap::new();
283 if query.is_empty() {
284 return Ok(params);
285 }
286
287 for pair in query.split('&') {
288 if pair.is_empty() {
289 continue;
290 }
291
292 let (raw_key, raw_value) = match pair.split_once('=') {
293 Some((key, value)) => (key, value),
294 None => (pair, ""),
295 };
296 let key = decode_query_component(raw_key)?;
297 let value = decode_query_component(raw_value)?;
298 params.entry(key).or_default().push(value);
299 }
300
301 Ok(params)
302}
303
304/// Decode a single query string component (key or value).
305///

Callers 3

handle_forward_proxyFunction · 0.85
parse_http_requestFunction · 0.85
parse_target_queryFunction · 0.85

Calls 3

decode_query_componentFunction · 0.85
pushMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected