MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / request

Method request

http-client/src/prpc.rs:37–50  ·  view source on GitHub ↗
(&self, path: &str, body: T)

Source from the content-addressed store, hash-verified

35
36impl RequestClient for PrpcClient {
37 async fn request<T, R>(&self, path: &str, body: T) -> Result<R, Error>
38 where
39 T: Message + Serialize,
40 R: Message + DeserializeOwned,
41 {
42 let body = serde_json::to_vec(&body).context("Failed to serialize body")?;
43 let path = format!("{}{path}?json", self.path_append);
44 let (status, body) = super::http_request("POST", &self.base_url, &path, &body).await?;
45 if status != 200 {
46 anyhow::bail!("Invalid status code: {status}, path={path}");
47 }
48 let response = serde_json::from_slice(&body).context("Failed to deserialize response")?;
49 Ok(response)
50 }
51}

Callers 1

http_requestFunction · 0.45

Calls 1

http_requestFunction · 0.85

Tested by

no test coverage detected