MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / request_json

Method request_json

crates/openshell-driver-podman/src/client.rs:362–376  ·  view source on GitHub ↗

Perform a request and deserialize the JSON response.

(
        &self,
        method: hyper::Method,
        path: &str,
        body: Option<&Value>,
    )

Source from the content-addressed store, hash-verified

360
361 /// Perform a request and deserialize the JSON response.
362 async fn request_json<T: DeserializeOwned>(
363 &self,
364 method: hyper::Method,
365 path: &str,
366 body: Option<&Value>,
367 ) -> Result<T, PodmanApiError> {
368 let (status, bytes) = self.request(method, path, body, API_TIMEOUT).await?;
369 if status.is_success() {
370 serde_json::from_slice(&bytes).map_err(|e| {
371 PodmanApiError::Json(format!("{e}: {}", String::from_utf8_lossy(&bytes)))
372 })
373 } else {
374 Err(error_from_response(status.as_u16(), &bytes))
375 }
376 }
377
378 /// Perform a request that returns no meaningful body.
379 async fn request_ok(

Callers 6

create_containerMethod · 0.80
inspect_containerMethod · 0.80
list_containersMethod · 0.80
inspect_volumeMethod · 0.80
network_gateway_ipMethod · 0.80
system_infoMethod · 0.80

Calls 2

error_from_responseFunction · 0.85
requestMethod · 0.80

Tested by

no test coverage detected