Strip trailing slash from API URL to prevent double slashes

Fixes issue where API URL like 'https://towerops.net/' would result in
URLs like 'https://towerops.net//api/v1/agent/config' causing 406 errors.
This commit is contained in:
Graham McIntire 2026-01-14 16:45:27 -06:00
parent 4a33be4f23
commit 3622cbf0ee
No known key found for this signature in database

View file

@ -46,6 +46,8 @@ pub struct ApiClient {
impl ApiClient {
/// Create a new API client
pub fn new(base_url: String, token: String) -> Result<Self> {
// Strip trailing slash from base_url to avoid double slashes in URLs
let base_url = base_url.trim_end_matches('/').to_string();
Ok(Self { base_url, token })
}