diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-10-26 16:10:45 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-12-04 09:06:30 +0100 |
| commit | 0d638dbbde30141a2da5ac64556e192fc98b633e (patch) | |
| tree | 46364903f2a422b91dc9f2125b6f8d6e4b1faf94 /mullvad-api/src | |
| parent | 960a0ed3c41603f488114f95a3c8a8c27ff7ca96 (diff) | |
| download | mullvadvpn-0d638dbbde30141a2da5ac64556e192fc98b633e.tar.xz mullvadvpn-0d638dbbde30141a2da5ac64556e192fc98b633e.zip | |
Move access method testing logic to `mullvad-daemon`
Move access method testing logic to `mullvad-daemon`, which means that
the implementation details of how the test works is opaque to whatever
frontend which wants to issue a test of some (configured) access method.
Diffstat (limited to 'mullvad-api/src')
| -rw-r--r-- | mullvad-api/src/lib.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index c0024b22ee..5427f51aad 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -620,4 +620,24 @@ impl ApiProxy { let response = self.handle.service.request(request).await?; response.deserialize().await } + + /// Check the availablility of `{APP_URL_PREFIX}/api-addrs`. + pub async fn api_addrs_available(&self) -> Result<(), rest::Error> { + let service = self.handle.service.clone(); + + rest::send_request( + &self.handle.factory, + service, + &format!("{APP_URL_PREFIX}/api-addrs"), + Method::HEAD, + None, + &[StatusCode::OK], + ) + .await?; + + // NOTE: A HEAD request should *not* have a body: + // https://developer.mozilla.org/en-US/docs/web/http/methods/head + // I.e., no need to deserialize the result. + Ok(()) + } } |
