← All Modules

assay.healthcheck

HTTP health checking utilities. Status codes, JSON path, body matching, latency, multi-check. Module-level functions (no client needed): M.function(url, ...).

Example:

local hc = require("assay.healthcheck")
local result = hc.multi({
  {name = "api", check = function() return hc.http("http://api:8080/health") end},
  {name = "db-field", check = function() return hc.json_path("http://api:8080/health", "database", "ok") end},
  {name = "latency", check = function() return hc.endpoint("http://api:8080/health", {max_latency_ms = 500}) end},
})
assert.eq(result.ok, true, result.failed .. " health checks failed")