Skip to content
Back to skills

Httpie Api Test

ASecurity

API 接口测试工作流,使用 HTTPie 作为核心工具。当用户需要测试 API 接口、执行接口调用、生成测试报告、管理接口依赖关系、或在项目中建立标准化的接口测试流程时使用此 skill。适用于 RESTful API 测试、接口联调、回归测试等场景。

  • 666 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added February 9, 2026
documentationpythonbashapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill httpie-api-test --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Httpie Api Test?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Httpie Api Test
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-httpie-api-test/badge)](https://www.skillsdirectory.com/skills/majiayu000-httpie-api-test)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: httpie-api-test
description: API 接口测试工作流,使用 HTTPie 作为核心工具。当用户需要测试 API 接口、执行接口调用、生成测试报告、管理接口依赖关系、或在项目中建立标准化的接口测试流程时使用此 skill。适用于 RESTful API 测试、接口联调、回归测试等场景。
---

# HTTPie API Test

使用 HTTPie 进行 API 测试的标准化工作流。

## 核心工具

HTTPie 比 curl 更优雅。安装:

```bash
# macOS
brew install httpie

# Ubuntu/Debian
apt install httpie

# pip
pip install httpie
```

## API 注册表

在项目根目录创建 `api-registry.md` 作为接口测试的神经中枢。完整格式见 [references/api-registry.md](references/api-registry.md)。

### 基本结构

```markdown
# API Registry

## Environment
| Name | Value |
|------|-------|
| BASE_URL | https://api.example.com |
| TOKEN | Bearer xxx |

## Endpoints

### [GET] /users - 获取用户列表
- Status: tested
- Depends: none
- Last tested: 2024-01-15

**Request:**
http GET $BASE_URL/users Authorization:$TOKEN

**Expected:** 200, 返回用户数组

---

### [POST] /users - 创建用户
- Status: pending
- Depends: none

**Request:**
http POST $BASE_URL/users Authorization:$TOKEN \
  name="张三" email="test@example.com"

**Expected:** 201, 返回新用户对象
```

## 工作流

### 1. 初始化

在项目根目录创建 `api-registry.md`,定义环境变量和接口列表。

### 2. 执行测试

读取注册表,按依赖顺序执行:

```bash
# 设置环境变量
export BASE_URL="https://api.example.com"
export TOKEN="Bearer your-token"

# GET
http GET $BASE_URL/users Authorization:$TOKEN

# POST with JSON body
http POST $BASE_URL/users Authorization:$TOKEN \
  name="测试" email="test@example.com"

# 保存响应
http GET $BASE_URL/users Authorization:$TOKEN > response.json
```

### 3. 更新状态

测试完成后更新注册表中的 `Status` 和 `Last tested` 字段。

### 4. 生成报告

```bash
python scripts/generate_report.py api-registry.md -o test-report.md
```

## HTTPie 速查

```bash
# Headers
http url Header:Value

# 认证
http -a user:pass url

# 表单提交
http -f POST url field=value

# 仅显示 headers
http --headers url

# 详细模式
http --verbose url
```

## 依赖管理

用 `Depends` 字段声明依赖关系:

```markdown
### [DELETE] /users/{id} - 删除用户
- Status: pending
- Depends: POST /users
```

测试时按依赖拓扑排序执行。

## 状态标记

| Status | 含义 |
|--------|------|
| pending | 待测试 |
| tested | 已通过 |
| failed | 测试失败 |
| blocked | 被阻塞 |
| deprecated | 已废弃 |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.