Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the options required in httpcli #582

Closed
bertysentry opened this issue Feb 10, 2025 · 2 comments · Fixed by #600
Closed

Simplify the options required in httpcli #582

bertysentry opened this issue Feb 10, 2025 · 2 comments · Fixed by #600
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@bertysentry
Copy link
Member

bertysentry commented Feb 10, 2025

Use Case

I want to use httpcli just like cURL or wget, without having to type --method and --url.

Suggested Change

httpcli [GET|POST|PUT|HEAD] <url> [OPTIONS]

If no method is specified, GET is assumed.

--method is still allowed to specify a rare method (example: --method PATCH).

If main arguments are provided (with no dashes):

  • First argument is the method if it's GET|POST|PUT|HEAD. If not among these values, then method GET is assumed, and first argument is considered as the URL
  • Second argument is the URL

If the URL doesn't start with http:// or https://, add https://.

If a method is specified as a main argument, and if the --method option is specified, the --method value overrides the main argument: httpcli POST https://server/login --method PATCH will use PATCH.

Same for URL: httpcli https://server/login --url https://server/info will request https://server/info.

@bertysentry
Copy link
Member Author

Let me know if this is unclear! 😅

@NassimBtk
Copy link
Member

Clear! 😁

@NassimBtk NassimBtk added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 10, 2025
@NassimBtk NassimBtk added this to the 1.0.02 milestone Feb 10, 2025
CherfaElyes added a commit that referenced this issue Feb 18, 2025
* Simplified httpcli options by adding two parameters `positionalMethod` and `positionalUrl` which allow to create CLI requests without using `--method` and `--url`.
* Handled all the possible cases when the user specifies both positional parameters and options.
* Tested on MetricsHub.
@CherfaElyes CherfaElyes linked a pull request Feb 18, 2025 that will close this issue
CherfaElyes added a commit that referenced this issue Feb 18, 2025
* Remplacer le label de `positionalMethod` par `method`.
* Optimiser la méthode `resolveMethod()`.
* Tester sur metricshub.
NassimBtk added a commit that referenced this issue Feb 18, 2025
…y-the-options-required-in-httpcli

Issue #582: Simplify the options required in httpcli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants