From 8de9d9e9a13ba4e3b7e25b320a9767901aa93d52 Mon Sep 17 00:00:00 2001 From: Moshe Immerman Date: Mon, 9 Dec 2024 22:33:56 +0200 Subject: [PATCH] fix: http.responseContent --- checks/http.go | 2 +- fixtures/minimal/http_pass.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/checks/http.go b/checks/http.go index 8f4655d56..4aeac93b2 100644 --- a/checks/http.go +++ b/checks/http.go @@ -317,7 +317,7 @@ func (c *HTTPChecker) Check(ctx *context.Context, extConfig external.Check) pkg. } if check.ResponseContent != "" && !strings.Contains(responseBody, check.ResponseContent) { - return results.Failf("expected %v, found %v", check.ResponseContent, responseBody) + return results.Failf("expected %v, found %v", check.ResponseContent, pkg.TruncateMessage(responseBody)) } if check.MaxSSLExpiry > 0 { diff --git a/fixtures/minimal/http_pass.yaml b/fixtures/minimal/http_pass.yaml index 5de6e0be9..019bdc37e 100644 --- a/fixtures/minimal/http_pass.yaml +++ b/fixtures/minimal/http_pass.yaml @@ -37,3 +37,6 @@ spec: url: https://httpbin.demo.aws.flanksource.com/headers test: expr: json.headers["User-Agent"].startsWith("canary-checker/") + - name: http-body + url: https://httpbin.demo.aws.flanksource.com/html + responseContent: Herman Melville