跳至主要内容
小龙虾小龙虾AI
🤖

Api Tester

Perform structured HTTP/HTTPS requests (GET, POST, PUT, DELETE) with custom headers and JSON body support. Use for API testing, health checks, or interacting...

下载7.9k
星标6
版本1.0.0
健康医疗
安全通过

技能说明


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.
  • Error handling: Returns structured error object instead of throwing, ensuring safe execution.

如何使用「Api Tester」?

  1. 打开小龙虾AI(Web 或 iOS App)
  2. 点击上方「立即使用」按钮,或在对话框中输入任务描述
  3. 小龙虾AI 会自动匹配并调用「Api Tester技能完成任务
  4. 结果即时呈现,支持继续对话优化

相关技能