Skip to content

Commit 5488e98

Browse files
committed
fix: extract path params from URL in challenge_call using route definitions
Routes like /status/:hotkey and /hotkey/:hotkey had empty params because challenge_call() never matched the request path against registered route definitions to extract named parameters.
1 parent c9fe9df commit 5488e98

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

crates/rpc-server/src/jsonrpc.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,10 +1233,25 @@ impl RpcHandler {
12331233
// Use resolved_id for routing
12341234
let challenge_id = resolved_id;
12351235

1236+
// Extract path params by matching against registered route definitions
1237+
let path_params = {
1238+
let routes = self.challenge_routes.read();
1239+
let mut extracted = std::collections::HashMap::new();
1240+
if let Some(challenge_routes) = routes.get(&challenge_id) {
1241+
for route in challenge_routes {
1242+
if let Some(params) = route.matches(&method, &path) {
1243+
extracted = params;
1244+
break;
1245+
}
1246+
}
1247+
}
1248+
extracted
1249+
};
1250+
12361251
let request = RouteRequest {
12371252
method,
12381253
path,
1239-
params: std::collections::HashMap::new(),
1254+
params: path_params,
12401255
query,
12411256
headers,
12421257
body,

0 commit comments

Comments
 (0)