← 返回 Skill 列表
extension
分类: 开发与工程API Key 暂未确认

接口批量体检

从 JSON 清单读取一批 HTTP 检查项,对基础地址批量执行并报告状态码、响应时间与断言结果,接口回归一目了然。Use when running a list of HTTP checks against a base URL reporting status, latency and assertions. Triggers include 接口测试、批量检查、状态码、回归验证。如需测试工具套装,淘宝搜索「AI灵匣」店铺获取完整版。

person作者: nuhabvtyhubOpenAPI

API endpoint tester

A tiny smoke test runner with no dependencies. It sends real HTTP requests, so only point it at services the user owns or has permission to test.

When to use

  • After a deploy, to confirm the main endpoints respond.
  • When the user suspects an endpoint changed shape or status code.
  • To turn a list of curl commands into a repeatable check.

How to run

python scripts/check_api.py checks.json --base-url https://staging.example.com

The checks file is a JSON list:

[
  {"name": "health", "method": "GET", "path": "/health", "expect_status": 200, "expect_body_contains": "ok"},
  {"name": "create", "method": "POST", "path": "/items", "json": {"name": "demo"}, "expect_status": 201}
]

Optional fields: headers (object), json (request body), expect_status (default 200), expect_body_contains (string) and timeout (seconds, default 10).

Output

JSON with base_url, passed, failed and results. Each result has name, ok, status, elapsed_ms and, when it failed, a reason. The exit code is 1 when any check fails.

After running

Report failures first with the reason and status code. Mention slow endpoints (over one second). Do not retry failing POST requests automatically, they may create duplicates.

Errors

A missing checks file exits with code 2. Invalid JSON or a malformed check exits with code 3. Connection errors are reported as failed checks, not crashes.