Api Tester

👤 wanng-ide 📦 v1.0.0 ⭐ 4.2 ⬇️ 8.3K 下载
💻 开发编程 免费

📖 技能介绍

API Tester

7w4.net小葱技能站,你的AI助手技能库。

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 <token>' };
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 http and https modules.
  • 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.

🤖 AI 评测

整体质量不错,是一个可靠可用的API测试工具。零依赖设计很轻量,安装使用都很简单,文档说明清晰易懂,新手也能快速上手。它能处理常见的GET、POST等请求,错误提示也比较友好。不足之处是功能相对基础,缺少一些进阶特性(比如请求重试、代理支持等),对于复杂的测试场景可能不够用。日常简单使用完全没问题,但复杂需求需要找更专业的工具。

📊 多维度评分

适应性4
规范性4
有效性4.4
可靠性4.2
可信度4.5

📁 包含文件 (6 个)

📄 SKILL.md 1.5 KB
📄 _meta.json 129 B
📄 index.js 3.2 KB
📄 package.json 199 B
📄 scripts/test.js 1.3 KB
📄 skill-card.md 2 KB