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:
parent
4a33be4f23
commit
3622cbf0ee
1 changed files with 2 additions and 0 deletions
|
|
@ -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 })
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue