PUT request with JSON body, unwrap `ApiResponse` envelope.
(
&self,
path: &str,
body: &B,
)
| 198 | |
| 199 | /// PUT request with JSON body, unwrap `ApiResponse` envelope. |
| 200 | pub async fn put<B: Serialize, T: DeserializeOwned>( |
| 201 | &self, |
| 202 | path: &str, |
| 203 | body: &B, |
| 204 | ) -> Result<T, RemoteError> { |
| 205 | let url = format!("{}{}", self.base_url, path); |
| 206 | log::debug!("PUT {}", url); |
| 207 | |
| 208 | let resp = self |
| 209 | .http |
| 210 | .put(&url) |
| 211 | .json(body) |
| 212 | .send() |
| 213 | .await |
| 214 | .map_err(|e| RemoteError::other(format!("request failed: {}", e)))?; |
| 215 | |
| 216 | self.handle_response(resp).await |
| 217 | } |
| 218 | |
| 219 | /// DELETE request, returns `()` on success. |
| 220 | pub async fn delete(&self, path: &str) -> Result<(), RemoteError> { |
no test coverage detected