API Tester — 接口测试
v1.0.0API 接口测试工具,支持 HTTP 请求发送、响应验证和接口调试。
详细分析 ▾
运行时依赖
版本
- Initial release of api-tester, a lightweight, dependency-free HTTP client for OpenClaw. - Supports structured HTTP/HTTPS requests (GET, POST, PUT, DELETE) with custom headers and JSON body. - Automatically stringifies JSON bodies and parses JSON responses. - Includes timeout support (default 10s, configurable). - Provides structured response with status, headers, parsed data, raw body, and error messaging. - No external dependencies; uses Node.js built-in http/https modules.
安装命令
点击复制本土化适配说明
API Tester — 接口测试 安装说明: 安装命令:npx clawhub@latest install api-tester 支持国内镜像加速,使用 --registry https://cn.longxiaskill.com 参数可加速下载
技能文档
A lightweight, dependency-free HTTP client for OpenClaw.
Usage
Basic GET Request
const api = require('skills/api-tester');
const result = await api.request('GET', 'https://api.example.com/data');
console.log(result.status, result.data);
POST Request with JSON Body
const api = require('skills/api-tester');
const payload = { key: 'value' };
const headers = { 'Authorization': 'Bearer ' };
const result = await api.request('POST', 'https://api.example.com/submit', headers, payload);
Return Format
The request function returns a Promise resolving to:
{
status: 200, // HTTP status code
headers: { ... }, // Response headers
data: { ... }, // Parsed JSON body (if applicable) or raw string
raw: "...", // Raw response body string
error: "..." // Error message if request failed (network error, timeout)
}
Features
- Zero dependencies: Uses Node.js built-in
httpandhttpsmodules. - Auto-JSON: Automatically stringifies request body and parses response body if Content-Type matches.
- Timeout support: Default 10s timeout, configurable.
- Error handling: Returns structured error object instead of throwing, ensuring safe execution.