DELETE request, returns `()` on success.
(&self, path: &str)
| 161 | |
| 162 | /// DELETE request, returns `()` on success. |
| 163 | pub async fn delete(&self, path: &str) -> Result<(), RemoteError> { |
| 164 | let url = format!("{}{}", self.base_url, path); |
| 165 | log::debug!("DELETE {}", url); |
| 166 | |
| 167 | let resp = self |
| 168 | .http |
| 169 | .delete(&url) |
| 170 | .send() |
| 171 | .await |
| 172 | .map_err(|e| RemoteError::other(format!("request failed: {}", e)))?; |
| 173 | |
| 174 | crate::check_min_version_header(resp.headers()); |
| 175 | let status = resp.status(); |
| 176 | if status.is_success() { |
| 177 | Ok(()) |
| 178 | } else { |
| 179 | let body = resp.text().await.unwrap_or_default(); |
| 180 | Err(self.parse_error_body(status.as_u16(), &body)) |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /// Handle a response: check status, parse `ApiResponse<T>`, unwrap data. |
| 185 | async fn handle_response<T: DeserializeOwned>( |
no test coverage detected