ScriptsApr 12, 2026·2 min read

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.

TL;DR
Hurl runs and tests HTTP requests from plain text files with chaining, assertions, and CI/CD integration. Written in Rust.
§01

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.

§02

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.

§03

How to use

  1. Install Hurl:
brew install hurl                           # macOS
cargo install hurl                          # Rust
sudo apt install hurl                       # Debian/Ubuntu
  1. Create a .hurl file with your requests and assertions.
  1. Run it:
hurl api.hurl --test
§04

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.

§05

Related on TokRepo

§06

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

How does Hurl compare to Postman?+

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.

Can Hurl handle authentication?+

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.

Does Hurl support GraphQL?+

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.

Can I use Hurl in CI/CD?+

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.

Is Hurl fast?+

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)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets