feat(check): check JSON APIs against conditions on response values

A JSON check requests a URL with GET or POST, optional headers and body,
and requires the expected status and every condition: paths like
checks[0].state compared with ==, !=, <, <=, >, >=, contains, exists or
absent. Failures name the path, the value found and the expectation.
HTTP and JSON checks share the request code and its network guard.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 11:45:11 +01:00
1 parent 8fe56546a0
commit 0815148ea1
5 files changed
+474 -30

No files matched your search

+4 -1
View File
@@ -22,13 +22,15 @@ const (
ICMP Type = "icmp"
DNS Type = "dns"
TLS Type = "tls"
// JSON checks an HTTP API's JSON response against assertions.
JSON Type = "json"
// Heartbeat monitors are pinged by the monitored job; no checker runs
// them.
Heartbeat Type = "heartbeat"
)
// Types lists every check type.
var Types = []Type{HTTP, TCP, ICMP, DNS, TLS, Heartbeat}
var Types = []Type{HTTP, TCP, ICMP, DNS, TLS, JSON, Heartbeat}
// Passive reports whether t is reported to us rather than run by checkers.
func Passive(t Type) bool { return t == Heartbeat }
@@ -84,6 +86,7 @@ var impls = map[Type]impl{
DNS: dnsCheck{},
TLS: tlsCheck{},
JSON: jsonCheck{},
Heartbeat: heartbeatCheck{},
}