A simple Node.js command-line tool for making HTTP requests with configurable headers and body.
- Supports standard HTTP methods (
GET
,POST
,PUT
,DELETE
,PATCH
). - Allows custom headers and request body.
- Validates input URLs and request methods.
- Provides clear, formatted output messages.
Clone the repository and install dependencies:
npm install
Run the CLI tool with the following syntax:
node mailman.js [options] <name> <url>
# or
./mailman.js [options] <name> <url>
-h, --headers <headers>
: Specify request headers (JSON format).-b, --body <char>
: Request body content.
# Simple GET request
node mailman.js GET https://example.com
# POST request with headers and body
node mailman.js POST https://example.com -h '{"Content-Type":"application/json"}' -b '{"key":"value"}'
# Run all tests that are located in ./tests/cli-helpers.test.js
npm test
- GET
- POST
- PUT
- DELETE
- PATCH
- Validates URLs
- Validates HTTP methods
- Styled logging for enhanced readability
- Loading indicator for requests
commander
: Parses command-line argumentsloading-cli
: Provides visual loading spinnerchalk
: Colored terminal output
Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.