【工具】curl测试工具Hoppscotch 测试工具使用教程(零基础版)
Hoppscotch是一款免费、无需注册、能在浏览器直接使用的 API 测试工具,比 Postman 更轻量,适合快速调试接口。1️⃣ 快速开始(无需安装!方法 1:直接网页版(推荐)打开浏览器(Chrome/Firefox/Edge)访问官网 →免登录!直接使用方法 2:自托管部署(进阶)访问即可。2️⃣ 界面介绍(5秒上手)请求方法:GET/POST/PUT/DELETE 等URL 输入框:输
前言
Hoppscotch
是一款免费、无需注册、能在浏览器直接使用的 API 测试工具,比 Postman 更轻量,适合快速调试接口。
1️⃣ 快速开始(无需安装!)
方法 1:直接网页版(推荐)
- 打开浏览器(Chrome/Firefox/Edge)
- 访问官网 → https://hoppscotch.io
- 免登录!直接使用
方法 2:自托管部署(进阶)
如果需内网使用,可用 Docker 部署:
docker run -d -p 3000:3000 --name hoppscotch hoppscotch/hoppscotch
访问 http://localhost:3000
即可。
2️⃣ 界面介绍(5秒上手)
- 请求方法:GET/POST/PUT/DELETE 等
- URL 输入框:输入 API 地址(如
https://api.example.com/users
) - Headers/Params:添加请求头或查询参数
- Body:发送 JSON/Form 数据(POST 请求用)
- Send 按钮:点击发送请求
3️⃣ 发送第一个请求(GET 示例)
目标:测试一个公开的免费 API(获取笑话)。
- 选择请求方法:
GET
- 输入 URL:
https://api.github.com/users/zhengjingjiaozhu
- 点击 Send
- 查看响应:
{ "login": "zhengjingjiaozhu", "id": 198422725, "node_id": "U_kgDOC9OwxQ", "avatar_url": "https://avatars.githubusercontent.com/u/198422725?v=4", "gravatar_id": "", "url": "https://api.github.com/users/zhengjingjiaozhu", "html_url": "https://github.com/zhengjingjiaozhu", "followers_url": "https://api.github.com/users/zhengjingjiaozhu/followers", "following_url": "https://api.github.com/users/zhengjingjiaozhu/following{/other_user}", "gists_url": "https://api.github.com/users/zhengjingjiaozhu/gists{/gist_id}", "starred_url": "https://api.github.com/users/zhengjingjiaozhu/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/zhengjingjiaozhu/subscriptions", "organizations_url": "https://api.github.com/users/zhengjingjiaozhu/orgs", "repos_url": "https://api.github.com/users/zhengjingjiaozhu/repos", "events_url": "https://api.github.com/users/zhengjingjiaozhu/events{/privacy}", "received_events_url": "https://api.github.com/users/zhengjingjiaozhu/received_events", "type": "User", "user_view_type": "public", "site_admin": false, "name": "正经教主", "company": null, "blog": "", "location": "北京", "email": null, "hireable": null, "bio": "修行人,热爱修行,探索宇宙真谛。", "twitter_username": null, "public_repos": 2, "public_gists": 0, "followers": 0, "following": 0, "created_at": "2025-02-09T05:39:14Z", "updated_at": "2025-07-28T02:43:18Z" }
4️⃣ 发送 POST 请求(带 JSON 数据)
目标:模拟用户注册请求(需提交 JSON 数据)。
- 选择方法:
POST
- 输入 URL:
https://httpbin.org/post
- 设置 Headers:
Key Value Content-Type
application/json
- 输入 Body(JSON):
json
{ "username": "test_user", "password": "123456" }
- 点击 Send → 查看服务器返回的响应数据!
{
"args": {
"Content-Type": "application/json"
},
"data": "{ \"username\": \"test_user\", \"password\": \"123456\" }",
"files": {},
"form": {},
"headers": {
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Accept-Language": "zh-CN,zh;q=0.9",
"Content-Length": "49",
"Content-Type": "application/json",
"Host": "httpbin.org",
"Origin": "https://hoppscotch.io",
"Priority": "u=1, i",
"Referer": "https://hoppscotch.io/",
"Sec-Ch-Ua": "\"Chromium\";v=\"140\", \"Not=A?Brand\";v=\"24\", \"Google Chrome\";v=\"140\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"Windows\"",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "cross-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
"X-Amzn-Trace-Id": "Root=1-688b002d-7de7f8127b661c2806eb93d4"
},
"json": {
"password": "123456",
"username": "test_user"
},
"origin": "111.193.232.191",
"url": "https://httpbin.org/post?Content-Type=application%2Fjson"
}
以下内容为验证,小伙伴们自己试试。。。。
5️⃣ 高级技巧(提升效率)
技巧 1:导入 CURL 命令
直接粘贴 curl
命令,自动解析为 Hoppscotch 请求:
- 点击右上角
Import → cURL
- 粘贴如:
curl -X POST https://httpbin.org/post -H "Content-Type: application/json" -d '{"name":"Alice"}'
- 自动填充 URL、Headers 和 Body!
技巧 2:环境变量(动态替换 URL)
- 点击左下角
Environments
→+ New
- 添加变量(如
base_url = https://api.yourdomain.com
) - 在 URL 中使用
{{base_url}}/users
,切换环境自动更新!
技巧 3:保存请求到 Collections
- 点击请求面板的
Save
按钮 - 选择
New Collection
(如“用户管理API”) - 后续可直接复用历史请求!
6️⃣ 常见问题(FAQ)
❓ Q1: 需要翻墙吗?
→ 不需要!完全能在国内直接访问。
❓ Q2: 数据会存储到服务器吗?
→ 不会!所有数据仅保存在你的浏览器本地。
❓ Q3: 支持 GraphQL 或 WebSocket 吗?
→ 支持!顶部切换 HTTP/GraphQL/WebSocket 模式。
🎯 总结
- 优点:免安装、免注册、即时使用,适合快速调试 API。
- 适用场景:前端开发、后端联调、API 文档验证。
现在就去试试吧 → https://hoppscotch.io 🚀
更多推荐
所有评论(0)