MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / inspector_direct_request

Function inspector_direct_request

packages/server/src/api/routes.rs:1686–1715  ·  view source on GitHub ↗
(
    State(state): State<AppState>,
    Json(payload): Json<InspectorDirectRequestPayload>,
)

Source from the content-addressed store, hash-verified

1684}
1685
1686async fn inspector_direct_request(
1687 State(state): State<AppState>,
1688 Json(payload): Json<InspectorDirectRequestPayload>,
1689) -> Result<Json<Value>, AppError> {
1690 if payload.process_identifier <= 0 {
1691 return Err(AppError::bad_request(
1692 "`processIdentifier` must be a positive process id.",
1693 ));
1694 }
1695 let method = payload.method.trim();
1696 if !is_allowed_inspector_proxy_method(method) {
1697 return Err(AppError::bad_request(format!(
1698 "Unsupported inspector proxy method `{method}`."
1699 )));
1700 }
1701
1702 let wait = inspector_request_timeout(method);
1703 let result = state
1704 .inspectors
1705 .query_with_timeout(
1706 payload.process_identifier,
1707 method,
1708 payload.params.unwrap_or(Value::Null),
1709 wait,
1710 )
1711 .await
1712 .map_err(AppError::native)?;
1713
1714 Ok(json(json_value!({ "result": result })))
1715}
1716
1717async fn inspector_response(
1718 State(state): State<AppState>,

Callers

nothing calls this directly

Calls 4

jsonFunction · 0.85
query_with_timeoutMethod · 0.80

Tested by

no test coverage detected