# Hurl — Run and Test HTTP Requests with Plain Text > Hurl is a command-line tool that runs HTTP requests defined in a simple plain text format. Chain requests, capture values, assert responses, and use it for API testing in CI/CD. Written in Rust on top of libcurl for maximum compatibility. ## Install Save as a script file and run: ## Quick Use ```bash # Install brew install hurl # macOS cargo install hurl # Rust sudo apt install hurl # Debian/Ubuntu ``` Create `api.hurl`: ```hurl # Test login endpoint POST https://api.example.com/login Content-Type: application/json { "email": "w@tokrepo.com", "password": "secret" } HTTP 200 [Captures] token: jsonpath "$.token" [Asserts] jsonpath "$.token" isString # Use captured token GET https://api.example.com/me Authorization: Bearer {{token}} HTTP 200 [Asserts] jsonpath "$.email" == "w@tokrepo.com" jsonpath "$.roles" includes "admin" ``` ```bash hurl api.hurl # Run requests hurl --test api.hurl # Test mode (CI) hurl --very-verbose api.hurl # Debug hurl --json api.hurl # JSON output hurl --variable host=staging api.hurl ``` ## Intro Hurl is a command-line tool that runs HTTP requests defined in a simple plain text format. Chain multiple requests, capture response values into variables, and assert on status codes, headers, body content, and JSONPath expressions. Written in Rust on top of libcurl. Created by Orange (France Telecom) and open-sourced. - **Repo**: https://github.com/Orange-OpenSource/hurl - **Stars**: 18K+ - **Language**: Rust - **License**: Apache 2.0 ## What Hurl Does - **Plain text format** — readable, version-controllable `.hurl` files - **Request chaining** — multiple requests in one file - **Captures** — extract values from responses into variables - **Assertions** — status, header, body, JSONPath, XPath, regex - **Variables** — inject via CLI or capture - **Cookie handling** — automatic across requests - **Certificate** — client certs and custom CA - **Performance** — libcurl-based, very fast - **CI-friendly** — `--test` mode with exit codes - **Report** — HTML, JSON, JUnit XML output ## Comparison | Tool | Format | CI | Language | |---|---|---|---| | Hurl | Plain text | Excellent | Rust | | HTTPie | CLI args | OK | Python | | curl | CLI args | OK | C | | Bruno | .bru files | CLI | JS | | Postman | JSON/GUI | Newman | JS | ## 常见问题 FAQ **Q: Hurl vs curl?** A: curl 是单请求工具,Hurl 是多请求编排 + 断言工具。Hurl 内部用 libcurl,但加了链式请求、capture/assert、test mode。API 测试用 Hurl 更好。 **Q: 和 Postman 比?** A: Hurl 是纯文本 + CLI(Git 友好、CI 原生),Postman 是 GUI(可视化好但文件不好 diff)。开发者倾向 Hurl。 ## 来源与致谢 Sources - Docs: https://hurl.dev - GitHub: https://github.com/Orange-OpenSource/hurl - License: Apache 2.0 --- Source: https://tokrepo.com/en/workflows/42405722-364b-11f1-9bc6-00163e2b0d79 Author: Script Depot