DELETE request, returns `()` on success.
(&self, path: &str)
| 186 | |
| 187 | /// DELETE request, returns `()` on success. |
| 188 | pub async fn delete(&self, path: &str) -> Result<(), RemoteError> { |
| 189 | let url = format!("{}{}", self.base_url, path); |
| 190 | log::debug!("DELETE {}", url); |
| 191 | |
| 192 | let resp = self |
| 193 | .http |
| 194 | .delete(&url) |
| 195 | .send() |
| 196 | .await |
| 197 | .map_err(|e| RemoteError::other(format!("request failed: {}", e)))?; |
| 198 | |
| 199 | crate::check_min_version_header(resp.headers()); |
| 200 | let status = resp.status(); |
| 201 | if status.is_success() { |
| 202 | Ok(()) |
| 203 | } else { |
| 204 | let body = resp.text().await.unwrap_or_default(); |
| 205 | Err(self.parse_error_body(status.as_u16(), &body)) |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /// Handle a response: check status, parse `ApiResponse<T>`, unwrap data. |
| 210 | async fn handle_response<T: DeserializeOwned>( |
no test coverage detected