Skip to content

Commit

Permalink
Async client: add a missing slash to API endpoint path
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jan 16, 2025
1 parent 6f8e8fc commit 1775510
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ reqwest = { version = "0.12.12", features = [
], optional = true }
backtrace = { version = "0.3", optional = true }
thiserror = { version = "2", optional = true }
tokio = "1.43.0"


[dev-dependencies]
amqprs = { version = "2"}
cargo-nextest = "0.9.87"
cargo-nextest = "0.9.88"
regex = { version = "1", features = ["std"] }

[features]
Expand Down
2 changes: 1 addition & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ where
where
S: AsRef<str>,
{
format!("{}{}", self.endpoint, path.as_ref())
format!("{}/{}", self.endpoint, path.as_ref())
}
}

Expand Down
29 changes: 29 additions & 0 deletions tests/async_overview_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (C) 2023-2025 RabbitMQ Core Team ([email protected])
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use rabbitmq_http_client::api::Client;

mod test_helpers;
use crate::test_helpers::{endpoint, PASSWORD, USERNAME};

#[tokio::test]
async fn test_async_overview() {
let endpoint = endpoint();
let rc = Client::new(&endpoint, USERNAME, PASSWORD);

let result1 = rc.overview().await;
assert!(result1.is_ok(), "overview returned {:?}", result1);

let ov = result1.unwrap();
assert!(ov.object_totals.exchanges > 0);
}

0 comments on commit 1775510

Please sign in to comment.