3 releases (1 stable)
1.0.0 | Dec 4, 2024 |
---|---|
0.1.1 | Dec 4, 2024 |
0.1.0 | Dec 4, 2024 |
#532 in Web programming
344 downloads per month
24KB
416 lines
Asterisk: Universal API Testing CLI
A lightweight, cross-platform command-line tool for rapidly testing API endpoints across different project structures and frameworks.
Installation
cargo install asterisk-cli
Usage
asterisk <server-file> <endpoint> <method> [options]
Arguments
server-file
: Path to your server/API definition file (navigate to server directory and it accepts file name)endpoint
: Endpoint name or path (e.g., "users" or "api/users")method
: HTTP method (GET, POST, PUT, DELETE, PATCH)
Options
--body <json>
: Request body as JSON string--headers <headers>
: Custom headers (format: "key1:value1,key2:value2")--bearer <token>
: Bearer token for authentication--base-url <url>
: Base URL (default: http://localhost:3000)--timing
: Show request timing information--test
: Test mode (no actual request sent)
Examples
# Basic GET request
asterisk server.js users GET
# POST with JSON body
asterisk server.js users POST --body '{"name":"John","email":"john@example.com"}'
# Authenticated request
asterisk server.js protected GET --bearer "your-token-here"
# Custom headers and base URL
asterisk server.js users GET --headers "Accept:application/json,API-Key:123" --base-url "http://api.example.com"
Features
- 🔍 Intelligent endpoint matching
- 🚀 Framework-agnostic route detection
- 📝 Support for JSON payloads
- 🔒 Authentication handling
- ⚡ Request timing information
- 🎯 Fuzzy matching for endpoints
Supported Frameworks
- Express.js
- Fastify
- NestJS
- Spring Boot
- Flask
- And more...
Dependencies
~11–24MB
~360K SLoC