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.
What it is
Hurl is a command-line tool for running HTTP requests defined in a simple plain text format. Each .hurl file contains one or more requests with optional assertions, captures, and variable interpolation. You can chain requests (use the response from one as input to the next), assert response status codes, headers, and body content, and run the whole thing in CI/CD pipelines.
Hurl targets API developers, QA engineers, and anyone who tests HTTP endpoints. It sits between curl (too low-level for test suites) and Postman (too heavy for CI). Written in Rust on top of libcurl, it is fast and has zero runtime dependencies.
How it saves time or tokens
Writing API tests in code (pytest, Jest) requires boilerplate for HTTP calls, assertions, and setup. Hurl replaces that with a declarative plain-text format. A test that takes 20 lines of Python fits in 5 lines of Hurl. The files are readable by non-developers, version-control friendly, and execute in milliseconds.
How to use
- Install Hurl:
brew install hurl # macOS
cargo install hurl # Rust
sudo apt install hurl # Debian/Ubuntu
- Create a
.hurlfile with your requests and assertions.
- Run it:
hurl api.hurl --test
Example
# Test login endpoint
POST http://localhost:8080/api/login
Content-Type: application/json
{
"username": "admin",
"password": "secret"
}
HTTP 200
[Captures]
token: jsonpath "$.token"
[Asserts]
jsonpath "$.token" isString
# Use captured token for authenticated request
GET http://localhost:8080/api/profile
Authorization: Bearer {{token}}
HTTP 200
[Asserts]
jsonpath "$.username" == "admin"
This tests login, captures the JWT token, and uses it in the next request to verify the profile endpoint.
Related on TokRepo
- Testing Tools -- Tools for automated testing and quality assurance
- Automation Tools -- Automate repetitive development workflows
Common pitfalls
- Hurl files are whitespace-sensitive in request bodies. Ensure JSON payloads are properly formatted or the request will fail with parse errors.
- Variable capture scope is per-file. Variables captured in one request are available in subsequent requests within the same file, but not across files unless passed via
--variable. - Hurl does not replace full test frameworks for complex logic (loops, conditional branching). Use it for HTTP request/response testing and keep business logic tests in your language of choice.
Frequently Asked Questions
Postman is a GUI-based API testing platform with collaboration features. Hurl is a CLI tool with plain text files. Hurl excels in CI/CD pipelines and version control. Postman excels in interactive exploration and team collaboration.
Yes. Hurl supports basic auth, bearer tokens, cookies, and custom headers. You can capture tokens from login responses and reuse them in subsequent requests using variable interpolation.
Yes. Send GraphQL queries as POST requests with a JSON body containing the query field. Hurl treats it as a regular HTTP request and you can assert on the JSON response.
Yes. Hurl is designed for CI/CD. Use --test flag for TAP output, --report-junit for JUnit XML reports, and --report-html for HTML reports. It returns non-zero exit codes on test failures.
Yes. Hurl is written in Rust and uses libcurl for HTTP. It starts instantly with no runtime initialization. Running hundreds of requests takes seconds, making it suitable for large test suites in CI pipelines.
Citations (3)
- Hurl GitHub— Command-line HTTP testing tool written in Rust
- Hurl Documentation— Hurl file format and assertion syntax
- Hurl Samples— HTTP testing best practices in CI/CD
Related on TokRepo
Discussion
Related Assets
Moodle — Open-Source Learning Management System
The most widely used open-source learning platform, providing course management, assessments, and collaboration tools for educators and organizations worldwide.
Sylius — Headless E-Commerce Framework on Symfony
An open-source headless e-commerce platform built on Symfony and API Platform, designed for developers who need a customizable and API-first commerce solution.
Akaunting — Free Self-Hosted Accounting Software
A free, open-source online accounting application built on Laravel for small businesses and freelancers to manage invoices, expenses, and financial reports.