requestbaby · 快速上手requestbaby · Quick start

快速上手:发送你的第一个请求Quick start: send your first request

用过 Postman 的话,几分钟就能上手。桌面端用表单填写请求,不用先学 JSON;填好的内容保存成普通文件,可以放进 git,也可以交给命令行批量运行。If you have used Postman you will feel at home within minutes. The desktop app uses forms, so you do not need to learn JSON first. Everything is saved as plain files you can keep in git and run in bulk from the command line.

五步发出第一个请求Five steps to your first request

  1. 下载并打开桌面端Download and open the desktop app,选「新建项目」,起个名字。, choose “New project” and give it a name.
  2. 点侧栏的「新建」→ 用例,协议选 Click “New” in the sidebar → case, pick HTTP / HTTPS,填名称和地址。也可以直接粘贴浏览器里「Copy as cURL」复制的命令。 and fill in a name and URL. You can also paste a command copied with “Copy as cURL” from the browser.
  3. 在「请求」页填写方法、地址、查询参数、请求头和 Body。每一项都有开关,临时不想发的可以关掉,不用删。On the Request tab fill in the method, URL, query parameters, headers and body. Every row has a switch, so you can turn one off temporarily instead of deleting it.
  4. 点右上角「发送」,在响应区看状态码、耗时、响应体(格式化或原始)、响应头,以及等价的 cURL 命令。Click “Send” at the top right and read the status, time, body (formatted or raw), headers and the equivalent cURL command in the response area.
  5. 在响应的「字段」页,把鼠标移到想验证的字段上,点「断言值」「断言类型」生成断言,或点「捕获…」把值存成变量给后面的请求用。然后点「运行全部」,一次跑完所有用例。On the response’s Fields tab hover a field and click “Assert value” or “Assert type” to create an assertion, or “Capture…” to store it as a variable for later requests. Then click “Run all” to run every case at once.

想用命令行:Prefer the command line? requestbaby init myapi 生成项目, creates a project, requestbaby send <用例文件>requestbaby send <case file> 发一次, sends one case and requestbaby run 跑全部。 runs them all.

日常调接口会用到的What you use day to day

构造请求Build requests

任意 HTTP 方法,地址、查询参数、请求头逐项编辑。Body 支持 JSON、x-www-form-urlencoded、form-data(含文件上传)和 raw 文本,顺序和 Postman 一致。Any HTTP method, with URL, query parameters and headers edited row by row. Bodies can be JSON, x-www-form-urlencoded, form-data (including file upload) or raw text, in the same order as Postman.

环境与变量Environments and variables

dev / test / prod 各有一套地址和账号,请求里写 dev / test / prod each have their own addresses and accounts, referenced as {{baseUrl}} 引用。密码、token 可以标为 secret,只保存在本机,日志和报告里显示为 ****。 in requests. Passwords and tokens can be marked secret: they stay on your machine and show as **** in logs and reports.

接口之间传值Pass values between requests

登录拿到的 token 存成变量,后面的请求直接用。Cookie 会自动保存并带上。集合里写一次公共请求头(比如 Authorization),目录下的用例都会继承。Store the token from a login as a variable and use it in later requests. Cookies are saved and sent automatically. Put a shared header such as Authorization on the collection once and every case under it inherits it.

批量运行与结果Bulk runs and results

「运行全部」一次跑完,每个用例是通过还是失败一目了然;失败会写明断言了什么、期望什么、实际是什么。还能串成流程,或用 CSV / JSON 的多组数据重复运行,并保留运行历史。“Run all” runs everything and shows pass or fail per case. A failure says what was asserted, what was expected and what came back. Chain cases into flows, repeat them over CSV / JSON data, and keep a run history.

高级设置Advanced settings

每个请求可以单独设置超时、重试、是否跟随重定向、是否忽略证书错误;整个项目可以统一走 socks5 / http 代理,也可以一键关掉。Each request can set its own timeout, retries, redirect following and certificate checking. The whole project can go through a socks5 / http proxy, or switch it off in one click.

导入现有内容Import what you have

从 cURL、Postman 集合、OpenAPI / Swagger 导入现成的接口,不用从头录入。除了 HTTP,还能测 gRPC 和 WebSocket。Import existing endpoints from cURL, Postman collections and OpenAPI / Swagger instead of retyping them. Beyond HTTP you can also test gRPC and WebSocket.

从 Postman 过来:概念对照Coming from Postman: concept map

Postmanrequestbaby
Collection / Folder(集合、文件夹)Collection / Folder集合:Collections: folders under collections/ 下的目录,一个用例一个 JSON 文件, one JSON file per case
Request(请求)Request用例Case
Environment / Globals(环境、全局变量)Environment / Globals环境(dev / test / prod)与变量,写法同样是 Environments (dev / test / prod) and variables, written as {{变量}}{{variable}} too
Tests 里的断言Assertions in Tests「断言」页:状态码、响应头、响应体任意字段The Assertions tab: status, headers and any response field
Pre-request / Tests 脚本Pre-request / Tests scripts「脚本(进阶)」页:JS 脚本,API 与 The Scripts (advanced) tab: JS scripts, with a different API from pm.* 不同
Collection Runner / Newman「运行全部」,命令行 Run all, or requestbaby run / verify on the command line
Import(导入)Import导入 cURL、Postman、OpenAPI / SwaggerImport cURL, Postman and OpenAPI / Swagger
Code snippet(代码片段)Code snippet响应区的 cURL 页,可直接复制The cURL tab in the response area, ready to copy
Workspace 同步与分享Workspace sync and sharing用例是普通文件,用 git 共享和评审Cases are plain files: share and review them with git

下一步Next steps

想了解怎么把它用作对 AI 交付成果的验收,读To use it as an acceptance check for AI-delivered work, read 怎么验收 AI 写的代码how to accept AI-written code;遇到问题见; for help see the 支持页support page。.

下载 requestbabyDownload requestbaby