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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTTP methods #2

Merged
merged 4 commits into from Feb 8, 2021
Merged

Support HTTP methods #2

merged 4 commits into from Feb 8, 2021

Conversation

ridhoq
Copy link
Owner

@ridhoq ridhoq commented Feb 8, 2021

Adds optional argument for HTTP method. If one isn't passed, GET is used by default.

af POST https://google.com <-- POST google.com
af https://google.com <-- GET google.com

I had a lot of issues trying to support this optional argument. The author of ht opened this issue: clap-rs/clap#2122 which shows what I was trying to do. They ended up working around it as seen here. For now, I decided to use AllowMissingPositional, but we'll see if that changes.

However, there is a bug when using AllowMissingPositional (clap-rs/clap#1737) causes my usage message to look like this:

af 0.0.3
A (http) fetch CLI 馃榾馃憤

USAGE:
    af <URI> [METHOD]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <METHOD>    HTTP method. If no HTTP method is provided, GET is used by default [default: GET]
    <URI>       URI to fetch

The URI and METHOD args are swapped 馃う馃徑 I'm prolly gonna have to hack around this somehow or take a stab at fixing it upstream.

Closes #1

@ridhoq ridhoq merged commit f8b7918 into main Feb 8, 2021
@ridhoq ridhoq deleted the http-methods branch February 8, 2021 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support all HTTP methods
1 participant