1
0

refactor: 移除 defaults.http.method 配置,简化默认值体系

- HTTP checker defaults schema 不再支持 method 字段
- resolve 逻辑从三级 fallback 简化为两级(target -> 内置默认)
- 配置文件中出现 defaults.http.method 将触发未知字段校验错误
- per-target http.method 覆盖功能保持不变
- 同步更新示例配置、README 文档和测试用例
This commit is contained in:
2026-05-16 21:45:08 +08:00
parent 04c24e6796
commit e924732a02
7 changed files with 29 additions and 51 deletions

View File

@@ -173,7 +173,6 @@ defaults:
interval: "15s"
timeout: "5s"
http:
method: "POST"
headers:
Authorization: "Bearer token"
maxBodyBytes: "50MB"
@@ -186,6 +185,7 @@ targets:
interval: "1m"
http:
url: "http://example.com"
method: "POST"
ignoreSSL: true
maxRedirects: 5
expect:
@@ -255,7 +255,6 @@ targets:
interval: "30s"
timeout: "10s"
http:
method: "GET"
maxBodyBytes: "10MB"
targets:
- name: "override-all"
@@ -1038,19 +1037,19 @@ targets:
);
});
test("defaults.http.method 小写输入失败", async () => {
test("defaults.http.method 触发未知字段错误", async () => {
await expectConfigError(
"lowercase-default-method.yaml",
"unknown-default-method.yaml",
`defaults:
http:
method: post
method: POST
targets:
- name: "test"
type: http
http:
url: "http://example.com"
`,
"defaults.http.method 不在允许范围内",
"defaults.http.method 是未知字段",
);
});