MCPcopy Create free account
hub / github.com/c4pt0r/pie / parse_callback_query

Function parse_callback_query

crates/coding-agent/src/oauth.rs:214–232  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

212}
213
214fn parse_callback_query(path: &str) -> (Option<String>, Option<String>) {
215 let qpos = match path.find('?') {
216 Some(i) => i + 1,
217 None => return (None, None),
218 };
219 let mut code = None;
220 let mut state = None;
221 for pair in path[qpos..].split('&') {
222 if let Some((k, v)) = pair.split_once('=') {
223 let v = urldecode(v);
224 match k {
225 "code" => code = Some(v),
226 "state" => state = Some(v),
227 _ => {}
228 }
229 }
230 }
231 (code, state)
232}
233
234fn urlencode(s: &str) -> String {
235 let mut out = String::with_capacity(s.len());

Callers 2

await_callbackMethod · 0.70

Calls 2

urldecodeFunction · 0.85
findMethod · 0.80

Tested by 1