(
State(state): State<AppState>,
Json(payload): Json<InspectorDirectRequestPayload>,
)
| 1684 | } |
| 1685 | |
| 1686 | async 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 | |
| 1717 | async fn inspector_response( |
| 1718 | State(state): State<AppState>, |
nothing calls this directly
no test coverage detected