Skip to content

Open-source status page, incident response and uptime monitoring

fix: respect status code assertions instead of defaulting to 2xx check (#2462)

Maxeaf7e11d6a2a
diff --git a/apps/checker/pkg/job/http_job.go b/apps/checker/pkg/job/http_job.go
index c0161e333..0163233cc 100644
--- a/apps/checker/pkg/job/http_job.go
+++ b/apps/checker/pkg/job/http_job.go
@@ -154,7 +154,14 @@ func (jr jobRunner) HTTPJob(ctx context.Context, monitor *v1.HTTPMonitor, region
}
status := statusCode(res.Status)
+ // Only use default 2xx check if no status assertions exist
+ // If status assertions are configured, let them determine success
+ hasStatusAssertions := len(monitor.StatusCodeAssertions) > 0
isSuccessful := status.IsSuccessful()
+ if hasStatusAssertions {
+ isSuccessful = true // Start with true, assertions will override
+ }
+
if len(monitor.HeaderAssertions) > 0 {
headersAsString, err := json.Marshal(res.Headers)
if err != nil {