PUT request with JSON body, unwrap `ApiResponse` envelope.
(
&self,
path: &str,
body: &B,
)
| 166 | |
| 167 | /// PUT request with JSON body, unwrap `ApiResponse` envelope. |
| 168 | pub async fn put<B: Serialize, T: DeserializeOwned>( |
| 169 | &self, |
| 170 | path: &str, |
| 171 | body: &B, |
| 172 | ) -> Result<T, RemoteError> { |
| 173 | let url = format!("{}{}", self.base_url, path); |
| 174 | log::debug!("PUT {}", url); |
| 175 | |
| 176 | let resp = self |
| 177 | .http |
| 178 | .put(&url) |
| 179 | .json(body) |
| 180 | .send() |
| 181 | .await |
| 182 | .map_err(|e| RemoteError::other(format!("request failed: {}", e)))?; |
| 183 | |
| 184 | self.handle_response(resp).await |
| 185 | } |
| 186 | |
| 187 | /// DELETE request, returns `()` on success. |
| 188 | pub async fn delete(&self, path: &str) -> Result<(), RemoteError> { |
no test coverage detected