PUT request with JSON body, unwrap `ApiResponse` envelope.
(
&self,
path: &str,
body: &B,
)
| 141 | |
| 142 | /// PUT request with JSON body, unwrap `ApiResponse` envelope. |
| 143 | pub async fn put<B: Serialize, T: DeserializeOwned>( |
| 144 | &self, |
| 145 | path: &str, |
| 146 | body: &B, |
| 147 | ) -> Result<T, RemoteError> { |
| 148 | let url = format!("{}{}", self.base_url, path); |
| 149 | log::debug!("PUT {}", url); |
| 150 | |
| 151 | let resp = self |
| 152 | .http |
| 153 | .put(&url) |
| 154 | .json(body) |
| 155 | .send() |
| 156 | .await |
| 157 | .map_err(|e| RemoteError::other(format!("request failed: {}", e)))?; |
| 158 | |
| 159 | self.handle_response(resp).await |
| 160 | } |
| 161 | |
| 162 | /// DELETE request, returns `()` on success. |
| 163 | pub async fn delete(&self, path: &str) -> Result<(), RemoteError> { |
no test coverage detected