| Crates.io | httprunner |
| lib.rs | httprunner |
| version | 0.6.45 |
| created_at | 2025-10-26 18:16:12.565804+00 |
| updated_at | 2026-01-18 10:45:39.208456+00 |
| description | HTTP File Runner - CLI tool for executing HTTP requests from .http files |
| homepage | https://github.com/christianhelle/httprunner |
| repository | https://github.com/christianhelle/httprunner |
| max_upload_size | |
| id | 1901693 |
| size | 68,926 |
A simple command-line tool written in Rust that parses .http files and executes HTTP requests, providing colored output with emojis to indicate success or failure.
.http files.http files in a single run--discover mode to recursively find and run all .http files--verbose mode for detailed request and response information--pretty-json flag to format JSON payloads in verbose output for improved readability--log mode to save all output to a file for analysis and reporting--report flag to generate summary reports in markdown or html format for test results--insecure flag for development environmentsguid(), string(), number(), base64_encode())@dependsOn and @if directives for request dependencies# Run a single .http file
httprunner <http-file>
# Run with verbose output
httprunner <http-file> --verbose
# Run with verbose output and pretty-printed JSON
httprunner <http-file> --verbose --pretty-json
# Run with insecure HTTPS (accept invalid certificates)
httprunner <http-file> --insecure
# Run and save output to a log file
httprunner <http-file> --log
# Run and generate a summary report (defaults to markdown)
httprunner <http-file> --report
# Run and generate an HTML summary report
httprunner <http-file> --report html
# Run and generate a markdown summary report (explicit)
httprunner <http-file> --report markdown
# Run without the donation banner
httprunner <http-file> --no-banner
# Run multiple .http files
httprunner <http-file1> <http-file2> [...]
# Discover and run all .http files recursively
httprunner --discover
# Show version information
httprunner --version
# Show help
httprunner --help
The HTTP File Runner supports a simple format for defining HTTP requests:
# Comments start with #
# Basic GET request
GET https://api.github.com/users/octocat
# Request with headers
GET https://httpbin.org/headers
User-Agent: HttpRunner/1.0
Accept: application/json
# POST request with body
POST https://httpbin.org/post
Content-Type: application/json
{
"name": "test",
"value": 123
}
The HTTP File Runner provides built-in functions for dynamic value generation in your .http files. Functions are case-insensitive and automatically generate values when the request is executed.
guid() - Generate UUIDGenerates a new UUID v4 (Universally Unique Identifier) in simple format (32 hex characters without dashes).
POST https://api.example.com/users
Content-Type: application/json
{
"id": "guid()",
"requestId": "GUID()"
}
string() - Generate Random StringGenerates a random alphanumeric string of 20 characters.
POST https://api.example.com/test
Content-Type: application/json
{
"sessionKey": "string()",
"token": "STRING()"
}
number() - Generate Random NumberGenerates a random number between 0 and 100 (inclusive).
POST https://api.example.com/data
Content-Type: application/json
{
"randomValue": "number()",
"percentage": "NUMBER()"
}
base64_encode() - Base64 EncodingEncodes a string to Base64 format. The string must be enclosed in single quotes.
POST https://api.example.com/auth
Content-Type: application/json
{
"credentials": "base64_encode('username:password')",
"token": "BASE64_ENCODE('Hello, World!')"
}
guid(), GUID(), and Guid() all work identicallySee examples/functions.http for a complete demonstration:
POST https://httpbin.org/post
Content-Type: application/json
{
"guid": "guid()",
"GUID": "GUID()",
"string": "string()",
"STRING": "STRING()",
"number": "number()",
"NUMBER": "NUMBER()",
"to_base64": "base64_encode('Hello, World!')",
"TO_BASE64": "BASE64_ENCODE('Hello, World!')"
}
The HTTP File Runner supports variables to make your .http files more flexible and reusable. Variables are defined using the @ syntax and can be referenced using double curly braces {{variable_name}}.
@hostname=localhost
@port=8080
@protocol=https
Variables can be referenced in URLs, headers, and request bodies:
@hostname=localhost
@port=44320
GET https://{{hostname}}:{{port}}/
# Request with variable in headers
GET https://{{hostname}}:{{port}}/api/users
Authorization: Bearer {{token}}
# Request with variables in body
POST https://{{hostname}}:{{port}}/api/users
Content-Type: application/json
{
"host": "{{hostname}}",
"endpoint": "https://{{hostname}}:{{port}}/profile"
}
Variables can be defined using values of other variables:
@hostname=localhost
@port=44320
@host={{hostname}}:{{port}}
@baseUrl=https://{{host}}
GET {{baseUrl}}/api/search/tool
Create a file named http-client.env.json to define environment-specific variables:
{
"dev": {
"HostAddress": "https://localhost:44320",
"ApiKey": "dev-api-key-123"
},
"prod": {
"HostAddress": "https://contoso.com",
"ApiKey": "prod-api-key-789"
}
}
Use the --env flag to specify which environment to use:
httprunner myfile.http --env dev
By default, httprunner validates SSL/TLS certificates and hostnames for secure HTTPS connections. For development environments with self-signed certificates or testing scenarios, you can use the --insecure flag to bypass certificate validation.
# Accept self-signed certificates
httprunner https-endpoints.http --insecure
# Combine with other flags
httprunner https-endpoints.http --insecure --verbose
httprunner https-endpoints.http --insecure --log test.log
When the --insecure flag is enabled:
# This will fail without --insecure if the certificate is self-signed
GET https://localhost:44320/api/users
Authorization: Bearer {{token}}
Run with:
httprunner api-test.http --insecure
⚠️ Security Warning: The --insecure flag disables certificate validation, making your connection vulnerable to man-in-the-middle attacks. Only use in controlled development or testing environments. Never use in production.
Request Variables allow you to chain HTTP requests by passing data from one request to another.
{{<request_name>.(request|response).(body|headers).(*|JSONPath|XPath|<header_name>)}}
# @name authenticate
POST https://httpbin.org/post
Content-Type: application/json
{
"username": "admin@example.com",
"password": "secure123",
"access_token": "jwt_token_here"
}
###
# @name get_data
GET https://httpbin.org/get
Authorization: Bearer {{authenticate.response.body.$.json.access_token}}
For JSON bodies:
$.property_name - Extract top-level properties$.nested.property - Extract nested properties* - Extract entire bodyFor headers:
header_name - Extract specific header value (case-insensitive)Execute requests conditionally based on previous request results using @dependsOn, @if, and @if-not directives:
# @name check-user
GET https://api.example.com/user/123
###
# Execute only if check-user returns 200
# @dependsOn check-user
PUT https://api.example.com/user/123
###
# Create if not found (404)
# @if check-user.response.status 404
POST https://api.example.com/user
###
# Update if user exists (NOT 404)
# @if-not check-user.response.status 404
PUT https://api.example.com/user/123
Customize request timeouts using comment directives:
# Read timeout (default: 60 seconds)
# @timeout 600
GET https://example.com/api/long-running
# Connection timeout (default: 30 seconds)
// @connection-timeout 10
GET https://example.com/api
# Time units: ms (milliseconds), s (seconds), m (minutes)
# @timeout 2 m
# @timeout 5000 ms
GET https://example.com/api
Validate HTTP responses with assertions:
# Status code assertion
GET https://httpbin.org/status/200
EXPECTED_RESPONSE_STATUS 200
# Status code and response body assertion
GET https://httpbin.org/status/404
EXPECTED_RESPONSE_STATUS 404
EXPECTED_RESPONSE_BODY "Not Found"
# Response header assertion
GET https://httpbin.org/json
EXPECTED_RESPONSE_STATUS 200
EXPECTED_RESPONSE_HEADERS "Content-Type: application/json"
The tool provides colored output with emojis:
🚀 HTTP File Runner - Processing file: examples/simple.http
==================================================
Found 4 HTTP request(s)
✅ GET https://httpbin.org/status/200 - Status: 200 - 145ms
❌ GET https://httpbin.org/status/404 - Status: 404 - 203ms
✅ GET https://api.github.com/zen - Status: 200 - 98ms
✅ GET https://jsonplaceholder.typicode.com/users/1 - Status: 200 - 112ms
==================================================
File Summary: 3 Passed, 1 Failed, 0 Skipped
Use --verbose for detailed request and response information, including headers, body content, and timing. Add --pretty-json to format JSON payloads for improved readability.
Generate summary reports in markdown or HTML format with --report:
# Generate report (defaults to markdown)
httprunner myfile.http --report
# Generate markdown report (explicit)
httprunner myfile.http --report markdown
# Generate HTML report
httprunner myfile.http --report html
# Combine with other flags
httprunner myfile.http --verbose --report html
httprunner --discover --report markdown
Reports include overall statistics, per-file breakdowns, and detailed request results. HTML reports feature responsive design with automatic light/dark mode support.
Save output to a file with --log:
# Save to default 'log' file
httprunner myfile.http --log
# Save to custom file
httprunner myfile.http --log results.txt
For complete documentation, installation options, and more examples, visit the GitHub repository.
MIT License - See LICENSE for details.
For more information, check out christianhelle.com
If you find this useful, feel free to buy me a coffee ☕