Skip to content

A lightweight HTTP testing tool that reads `.hit` files and executes HTTP requests with support for variables, comments, parallel execution, and comprehensive reporting.

Notifications You must be signed in to change notification settings

Mahmoud-Emad/hitman-cli

Repository files navigation

Hitman 🎯

VS Code Extension Crates.io GitHub Release

A lightweight, fast, and intuitive HTTP testing tool that reads .hit files and executes HTTP requests with support for variables, comments, and parallel execution.

✨ Features

  • 🚀 Simple Syntax: Easy-to-read .hit file format
  • 🔧 Variable Support: Define and reuse variables with {{variable}} syntax
  • 📝 Multiple Comment Styles: #, //, and /* */ comments
  • Parallel Execution: Run requests concurrently for faster testing
  • 🎨 Rich CLI: Comprehensive command-line interface with colored output
  • 📊 JSON Reports: Generate detailed execution reports
  • 🔍 Dry Run Mode: Validate syntax without sending requests
  • 🌐 Cross-Platform: Available for Linux, macOS, and Windows
  • 🎯 VS Code Extension: Official extension with syntax highlighting and IntelliSense

📦 Installation

Pre-built Binaries

Download from GitHub Releases →

  • Linux (x86_64): hitman-linux-x86_64.tar.gz
  • Linux (ARM64): hitman-linux-aarch64.tar.gz
  • macOS (Intel): hitman-macos-x86_64.tar.gz
  • macOS (Apple Silicon): hitman-macos-aarch64.tar.gz
  • Windows (x86_64): hitman-windows-x86_64.zip

Package Managers

# Rust/Cargo
cargo install hitman

# Homebrew (coming soon)
brew install hitman

🚀 Quick Start

1. Create a .hit file

# Define variables
DEFINE baseUrl="https://jsonplaceholder.typicode.com"
DEFINE userId=1

# Simple GET request
GET {{baseUrl}}/users/{{userId}}

# POST request with data
POST {{baseUrl}}/posts
    WITH HEADER {
        "Content-Type": "application/json"
    }
    WITH DATA {
        "title": "My Post",
        "body": "This is the post content",
        "userId": {{userId}}
    }

2. Run it

# Execute requests
hitman example.hit

# Dry run (validate without sending)
hitman example.hit --dry-run

# Verbose output
hitman example.hit --verbose

# Parallel execution
hitman example.hit --parallel

🎨 VS Code Extension

Enhance your .hit file editing experience:

Install from VS Code Marketplace →

Features:

  • 🎨 Syntax highlighting
  • 📝 IntelliSense and autocomplete
  • ❌ Error detection and validation
  • 🔧 Code formatting
  • 📋 Snippets and templates

🔧 Key Features

Variables and Substitution

DEFINE token="abc123"
DEFINE user={"name": "John", "age": 30}

GET https://api.example.com/profile
    WITH HEADER {"Authorization": "Bearer {{token}}"}
    WITH DATA {{user}}

Multiple HTTP Methods

GET https://api.example.com/users
POST https://api.example.com/users
PUT https://api.example.com/users/1
DELETE https://api.example.com/users/1

Flexible Comments

# Hash comments
// Double slash comments
/* Block comments */

GET https://api.example.com/users  # Inline comments

🛠️ CLI Options

# Basic usage
hitman requests.hit

# Common options
hitman requests.hit --dry-run          # Validate without sending
hitman requests.hit --verbose          # Detailed output
hitman requests.hit --parallel         # Concurrent execution
hitman requests.hit --quiet            # Minimal output

# Variable overrides
hitman requests.hit --define baseUrl="https://staging.api.com"
hitman requests.hit --env staging.env

# Reporting
hitman requests.hit --report results.json

📚 Examples

Explore comprehensive examples in the examples/ directory:

Quick Example Run

# Try the real-world example
hitman examples/real-world-api-testing.hit

# Test authentication patterns
hitman examples/authentication-patterns.hit --dry-run

# Run CRUD operations
hitman examples/rest-api-crud.hit --parallel

📖 Documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/Mahmoud-Emad/hitman-cli.git
cd hitman-cli

# Build and test
cargo build
cargo test

# Run locally
cargo run -- example.hit --dry-run

📄 License

This project is licensed under the MIT OR Apache-2.0 license.

🔗 Links


Made with ❤️ for developers who love simple, powerful HTTP testing tools.

About

A lightweight HTTP testing tool that reads `.hit` files and executes HTTP requests with support for variables, comments, parallel execution, and comprehensive reporting.

Resources

Stars

Watchers

Forks

Packages

No packages published