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

Method request

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

Perform a versioned HTTP request and return status + body bytes.

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

Source from the content-addressed store, hash-verified

335
336 /// Perform a versioned HTTP request and return status + body bytes.
337 async fn request(
338 &self,
339 method: hyper::Method,
340 path: &str,
341 body: Option<&Value>,
342 timeout: Duration,
343 ) -> Result<(hyper::StatusCode, Bytes), PodmanApiError> {
344 let (full_body, content_type) = match body {
345 Some(json) => {
346 let payload =
347 serde_json::to_vec(json).map_err(|e| PodmanApiError::Json(e.to_string()))?;
348 (Full::new(Bytes::from(payload)), Some("application/json"))
349 }
350 None => (Full::new(Bytes::new()), None),
351 };
352 let req = Self::build_request(
353 method,
354 &format!("/{API_VERSION}{path}"),
355 full_body,
356 content_type,
357 );
358 self.send_request(req, timeout).await
359 }
360
361 /// Perform a request and deserialize the JSON response.
362 async fn request_json<T: DeserializeOwned>(

Callers 11

prepare_backend_requestFunction · 0.80
http_health_checkFunction · 0.80
request_jsonMethod · 0.80
request_okMethod · 0.80
stop_containerMethod · 0.80
pull_imageMethod · 0.80
postJsonFunction · 0.80

Calls 1

send_requestMethod · 0.80