1.8 KiB
1.8 KiB
HTTP Checker
type: http 用于 HTTP/HTTPS 应用层健康检查。
配置项
| 字段 | 说明 | 必填 | 默认值 |
|---|---|---|---|
http.url |
目标 URL | 是 | 无 |
http.method |
HTTP 方法 | 否 | GET |
http.headers |
请求头 | 否 | 无 |
http.body |
请求体 | 否 | 无 |
http.ignoreSSL |
忽略 HTTPS 证书校验 | 否 | false |
http.maxRedirects |
最大重定向跟随次数 | 否 | 0 |
expect 校验项
| 字段 | 说明 | 必填 | 默认值 |
|---|---|---|---|
status |
可接受的状态码列表,支持精确码和范围(如 "2xx") |
否 | [200] |
headers |
响应头校验,使用 KeyedExpectations |
否 | 无 |
body |
响应体校验,使用 ContentExpectations 数组 |
否 | 无 |
durationMs |
完整执行耗时校验,使用 ValueMatcher |
否 | 无 |
示例
- id: "json-api"
name: "JSON API 示例"
type: http
http:
url: "https://httpbin.org/json"
headers:
Authorization: "Bearer token"
expect:
status: [200]
headers:
Content-Type:
contains: "application/json"
body:
- json:
path: "$.slideshow.title"
equals: "Sample Slide Show"
durationMs:
lte: 10000
HTTP checker 的 durationMs 覆盖完整执行,包括重定向、按需响应体读取、解码和 expect 校验。未配置 body expectation、status 失败或 headers 失败时不会读取 body。