Skip to content

Commit 480dd53

Browse files
committed
19271 HTTP web service - reintroduce URL in service summary
_Check HTTP web service_ now shows the checked URL as the first item in the service summary, rendered as a clickable icon. SUP-26430 Change-Id: I7592de87d74f0803f1f0b46bc1ef2f3711300605
1 parent 7f5c872 commit 480dd53

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

.werks/19271.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[//]: # (werk v3)
2+
# HTTP web service - reintroduce URL in service summary
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-01-26T10:26:47+00:00
7+
version | 2.6.0b1
8+
class | feature
9+
edition | community
10+
component | checks
11+
level | 1
12+
compatible | yes
13+
14+
_Check HTTP web service_ now prominently displays the checked URL as the first item in the service summary, rendered as a clickable icon.

packages/check-http/src/checks.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ pub fn collect_response_checks(
137137
}
138138

139139
fn check_urls(url: Url, final_url: Url, server: Option<String>) -> Vec<Option<CheckResult>> {
140-
let url_text = format!("URL to test: {}", url);
141-
let mut results = vec![CheckResult::details(State::Ok, &url_text)];
140+
let mut results = vec![
141+
CheckResult::summary(State::Ok, url.as_str()),
142+
CheckResult::details(State::Ok, &format!("URL to test: {}", url)),
143+
];
142144
// If we end up with a different final_url, we obviously got redirected.
143145
// Since we didn't run into an error, the redirect must be OK.
144146

@@ -635,10 +637,10 @@ mod test_check_urls {
635637
Url::parse("https://foo.bar/").unwrap(),
636638
None,
637639
),
638-
vec![CheckResult::details(
639-
State::Ok,
640-
"URL to test: https://foo.bar/"
641-
),]
640+
vec![
641+
CheckResult::summary(State::Ok, "https://foo.bar/"),
642+
CheckResult::details(State::Ok, "URL to test: https://foo.bar/"),
643+
]
642644
)
643645
}
644646

@@ -651,6 +653,7 @@ mod test_check_urls {
651653
None,
652654
),
653655
vec![
656+
CheckResult::summary(State::Ok, "https://foo.bar/"),
654657
CheckResult::details(State::Ok, "URL to test: https://foo.bar/"),
655658
CheckResult::details(State::Ok, "Followed redirect to: https://foo.bar/baz"),
656659
]

packages/check-http/tests/test_http.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ async fn check_http_output(
5050
expected_summary_start: &str,
5151
) -> AnyhowResult<()> {
5252
let (port, listener) = tcp_listener("0.0.0.0");
53-
let (client_cfg, request_cfg, request_information, check_params) = make_standard_configs(port);
53+
let url = Url::parse(&format!("http://{}:{}", LOCALHOST_DNS, port)).unwrap();
54+
let (client_cfg, request_cfg, request_information, check_params) =
55+
make_standard_configs(url.clone());
5456

5557
let check_http_thread = tokio::spawn(collect_checks(
5658
client_cfg,
@@ -65,20 +67,21 @@ async fn check_http_output(
6567

6668
assert!(check_http_payload.starts_with(expected_http_payload_start));
6769
assert!(output.worst_state == expected_state);
68-
assert!(output.to_string().starts_with(expected_summary_start));
70+
assert!(output
71+
.to_string()
72+
.starts_with(&format!("{}, {}", url, expected_summary_start)));
6973

7074
Ok(())
7175
}
7276

7377
fn make_standard_configs(
74-
port: u16,
78+
url: Url,
7579
) -> (
7680
ClientConfig,
7781
RequestConfig,
7882
RequestInformation,
7983
CheckParameters,
8084
) {
81-
let url = Url::parse(&format!("http://{}:{}", LOCALHOST_DNS, port)).unwrap();
8285
(
8386
ClientConfig {
8487
version: None,

0 commit comments

Comments
 (0)