pub async fn request_json<T: DeserializeOwned, R: Serialize>(
socket_path: impl AsRef<Path>,
method: Method,
path: &str,
body: Option<R>,
) -> Result<T>Expand description
Sends an HTTP request to the natmap daemon over its Unix socket and deserializes the JSON response.
Generic over T (response type, must implement DeserializeOwned) and R
(request body type, must implement Serialize). Pass None for body on
GET and DELETE requests.
ยงErrors
Returns an error if the daemon is unreachable, returns a non-success status code, or if JSON deserialization fails.