-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
apertre2.0Issues and PRs created during Apertre EventIssues and PRs created during Apertre EventenhancementNew feature or requestNew feature or requestmediumA difficulty tagA difficulty tag
Description
Describe the feature you are requesting
Currently, Termino-Logistic allows users to specify request headers only within YAML/JSON configuration files. However, there is no way to define headers dynamically via command-line arguments.
💡 Proposed Feature:
- Enable users to pass HTTP headers via CLI flags using the
-Hor--headeroption. - Allow multiple headers to be defined using the flag multiple times.
- Ensure that CLI-defined headers override headers set in the request file (if there’s a conflict).
📝 Example Usage:
# Sending a GET request with custom headers
termino -f request.yml -H "Authorization: Bearer mytoken" -H "User-Agent: CustomClient/1.0"Why is this feature needed?
- Improves flexibility by allowing users to quickly modify headers without editing configuration files.
- Useful for authentication (e.g., API keys, JWT tokens) where tokens may change frequently.
- Enhances debugging and testing, as users can quickly test API responses with different headers.
Implementation Plan
1️⃣ Modify Argument Parser (main.py)
Update parse_args() in main.py to accept custom headers as CLI arguments:
ap.add_argument(
"-H", "--header",
action="append",
help="Specify custom HTTP headers (use multiple times for multiple headers)"
)This allows users to pass -H "Key: Value" multiple times.
2️⃣ Process Headers in Yeeter (feet.py)
Modify the yeet() method to:
- Parse CLI headers into a dictionary.
- Merge CLI headers with request file headers (CLI headers take precedence).
3️⃣ Update Help Documentation in README.md
- Add an example of how to use the
-Hflag. - Clarify that CLI headers override request file headers if duplicated.
Additional Context
- 🚀 This feature aligns with industry-standard CLI tools like
curl, enhancing usability. - 🔥 Good First Issue for contributors familiar with Python, argparse, and API requests.
Would love feedback on the design! Feel free to contribute. 😃
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
apertre2.0Issues and PRs created during Apertre EventIssues and PRs created during Apertre EventenhancementNew feature or requestNew feature or requestmediumA difficulty tagA difficulty tag