Api Tester

👤 wanng-ide 📦 v1.0.0 ⭐ 4.2 ⬇️ 8.3K 下載
💻 開發程式設計 免費

📖 技能介紹


name: api-tester description: Perform structured HTTP/HTTPS requests (GET, POST, PUT, DELETE) with custom headers and JSON body support. Use for API testing, health checks, or interacting with REST services programmatically without relying on curl.


API Tester

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.

    7w4.net提供免費和付費技能下載。

  • 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