Quest
An HTTP client CLI for all your fetch (re)quests. Quest combines the simplicity of direct terminal commands with the power of reusable, templated request configurations.
Features
- Direct HTTP requests from the command line
- Reusable request templates in YAML quest files
- Environment variable support with default values
- Composable URLs with base_url and path
- YAML anchors and merge keys for DRY configurations
Installation
Or from source:
Quick Start
Direct Requests
Make HTTP requests directly from the command line:
# Simple GET request
# POST with JSON body
# With authentication
# With query parameters
# Multiple options
Quest Files
Define reusable requests in a .quests.yaml file:
# Define reusable defaults with YAML anchors
x-api-defaults:
base_url: https://api.example.com
bearer: "${API_TOKEN}"
accept: application/json
timeout: 30s
quests:
get-user:
<<: *api-defaults
method: get
path: /users/1
list-users:
<<: *api-defaults
method: get
path: /users
params:
- status=active
- limit=10
create-user:
<<: *api-defaults
method: post
path: /users
json: '{"name": "John Doe", "email": "john@example.com"}'
Execute named quests:
# List all available quests
# Run a quest from the file
# Override quest file settings from CLI
# Use a different quest file
Usage
HTTP Methods
Quest supports all standard HTTP methods:
Authentication
Bearer Token:
Basic Auth:
Custom Headers:
Query Parameters
Add query parameters to your requests:
# Single parameter
# Multiple parameters (short form)
In quest files:
quests:
search:
method: get
url: https://api.example.com/search
param: # or use "params" as alias
- q=rust
- type=repository
- sort=stars
Request Body
JSON Body:
# Inline JSON
# From file
Form Data:
Raw/Binary Data:
Headers
Custom Headers:
Common Headers:
Composable URLs
Instead of repeating full URLs, use base_url with path:
x-defaults:
base_url: https://api.example.com
bearer: "${API_TOKEN}"
quests:
get-users:
<<: *defaults
method: get
path: /users # Results in: https://api.example.com/users
get-user:
<<: *defaults
method: get
path: /users/1 # Results in: https://api.example.com/users/1
You can also use a direct url field if preferred:
quests:
get-user:
method: get
url: https://api.example.com/users/1
Environment Variables
Quest supports shell-style environment variable expansion with default values:
quests:
api-call:
method: get
url: ${API_URL:-https://api.example.com}/users
bearer: "${API_TOKEN}"
timeout: ${TIMEOUT:-30s}
Load environment variables from a file:
# Default: .env
# Custom env file
Timeouts
Request Timeout:
Connection Timeout:
Supported time units: s (seconds), m (minutes), h (hours), ms (milliseconds)
Redirects
Follow Redirects:
TLS/SSL
Skip Certificate Verification:
Client Certificates:
Custom CA Certificate:
Proxy
HTTP/HTTPS Proxy:
Proxy Authentication:
Output Options
Save to File:
Request Compressed Response:
Simple Output (no color):
Verbose Output:
Quest File Reference
Complete Example
# Define reusable configurations with YAML anchors
x-api-defaults:
base_url: https://api.example.com
bearer: "${API_TOKEN}"
accept: application/json
timeout: 30s
x-test-defaults:
base_url: https://httpbin.org
timeout: 10s
quests:
# Simple GET request
get-user:
<<: *api-defaults
method: get
path: /users/1
# GET with query parameters
search-users:
<<: *api-defaults
method: get
path: /users
params:
- status=active
- role=admin
- limit=50
# POST with JSON body
create-user:
<<: *api-defaults
method: post
path: /users
json: |
{
"name": "John Doe",
"email": "john@example.com",
"role": "user"
}
# POST with form data
upload-file:
<<: *api-defaults
method: post
path: /upload
form:
- name=document
- file=@document.pdf
- description=Important file
# Request with custom headers
custom-request:
<<: *api-defaults
method: get
path: /data
header:
- "X-Custom-Header: custom-value"
- "X-Request-ID: ${REQUEST_ID}"
# Using httpbin for testing
test-post:
<<: *test-defaults
method: post
path: /post
json: '{"test": "data"}'
param:
- foo=bar
Field Reference
URL Configuration:
url: Full URL (mutually exclusive with base_url/path)base_url: Base URL to combine with pathpath: Path to append to base_url
Request Configuration:
method: HTTP method (get, post, put, patch, delete)bearer: Bearer token authenticationbasic: Basic authentication (user:pass format)auth: Alias for basic authentication
Query Parameters:
param: List of query parameters (key=value format)params: Alias for param
Headers:
header: List of custom headers (key:value format)user_agent: User-Agent headeraccept: Accept headercontent_type: Content-Type headerreferer: Referer header
Body:
json: JSON body (string or @file)form: Form data (list of key=value)raw: Raw body databinary: Binary body data
Timeouts:
timeout: Overall request timeout (e.g., "30s", "1m")connect_timeout: Connection timeout
Redirects:
location: Follow redirects (boolean)max_redirects: Maximum redirects to follow
TLS:
insecure: Skip TLS verification (boolean)cert: Client certificate filekey: Client certificate key filecacert: CA certificate file
Proxy:
proxy: Proxy server URLproxy_auth: Proxy authentication (user:pass format)
Output:
output: Output file pathcompressed: Request compressed response (boolean)simple: Simple output without color (boolean)verbose: Verbose output (boolean)
Examples
See the .quests.yaml file for comprehensive examples of all features.
Environment Variables
Quest loads environment variables from .env by default, or from a file specified with -e:
# Use default .env
# Use custom env file
# Use .env.local
Environment variables can include default values using shell syntax:
${VAR:-default_value}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT