Fix incorrect splitting of multiple http integration endpoints.

Closes #62.
This commit is contained in:
Orne Brocaar 2022-11-17 13:00:17 +00:00
parent bfcff17f34
commit 9fe8ee2474

View File

@ -29,7 +29,7 @@ impl Integration {
json: conf.json, json: conf.json,
endpoints: conf endpoints: conf
.event_endpoint_url .event_endpoint_url
.split(' ') .split(',')
.map(|s| s.trim().to_string()) .map(|s| s.trim().to_string())
.collect(), .collect(),
} }
@ -183,6 +183,26 @@ pub mod test {
use super::*; use super::*;
use httpmock::prelude::*; use httpmock::prelude::*;
#[test]
fn test_url_split() {
let i = Integration::new(&HttpConfiguration {
headers: HashMap::new(),
json: true,
event_endpoint_url: "http://a.com,http://b.com, http://c.com , http://d.com"
.to_string(),
});
assert_eq!(
vec![
"http://a.com".to_string(),
"http://b.com".to_string(),
"http://c.com".to_string(),
"http://d.com".to_string(),
],
i.endpoints
);
}
#[tokio::test] #[tokio::test]
async fn test_http() { async fn test_http() {
let server = MockServer::start(); let server = MockServer::start();