From 9fe8ee24748ad3c691f6c7ff24e03fba0c1d1a11 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Thu, 17 Nov 2022 13:00:17 +0000 Subject: [PATCH] Fix incorrect splitting of multiple http integration endpoints. Closes #62. --- chirpstack/src/integration/http.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/chirpstack/src/integration/http.rs b/chirpstack/src/integration/http.rs index 88b2ca4f..f19770e4 100644 --- a/chirpstack/src/integration/http.rs +++ b/chirpstack/src/integration/http.rs @@ -29,7 +29,7 @@ impl Integration { json: conf.json, endpoints: conf .event_endpoint_url - .split(' ') + .split(',') .map(|s| s.trim().to_string()) .collect(), } @@ -183,6 +183,26 @@ pub mod test { use super::*; 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] async fn test_http() { let server = MockServer::start();