# 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 with REST services programmatically without relying on curl.

- Skill: `modbender/api-tester` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add modbender/api-tester`
- Raw SKILL.md: https://api.skillmd.com/api/skills/modbender/api-tester/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: modbender (https://skillmd.com/u/modbender)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/modbender/api-tester

---


# API Tester

A lightweight, dependency-free HTTP client for OpenClaw.

## Usage

### Basic GET Request

```javascript
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

```javascript
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:

```javascript
{
  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.

