-
Notifications
You must be signed in to change notification settings - Fork 385
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
Valid cURL invocation fails with httpstat because of URL position #19
Comments
After digging around with curl for a while, I found that
is very hard to achieve. curl actually don't care the position of URL, whether URL is at first, or last, or in the middle, as long as the other arguments follow the rules, curl can parse the inputs correctly. As to httpstat, we couldn't just pass all the arguments to curl directly, we have to find out the URL to decide whether to use http or https display template. Specify position is the easiest way to help getting the URL, if not specify, we have to implement an argument parser the same as curl's, which is not an easy work. In that case, whether the position is first or last doesn't make much difference, since both will still have invocation valid to curl but invalid to itself. What do you think? |
Thank you for the prompt reply. I think replicating
Anyway, it is a minor issue or even just a matter of habit. |
Actually the usage has made it clear that the URL should be put at the first position: $ python httpstat.py
Usage: httpstat URL [CURL_OPTIONS]
httpstat -h | --help
httpstat --version The time I was considering the URL's position, I was thinking that httpstat itself actually has no option. So it should be distinguished from normal situation, where intuitively options are put after command and before the main arguments. Thus when you see In conclusion, the position of URL won't be changed, thanks for your suggestion and cooperation :) P.S. it's easy to modify the code for your own to make URL at the last position, just change L180 to |
An invocation that would be valid with cURL:
curl -X GET http://www.google.de/
gives the following error with httpstat:
whereas the command
httpstat http://www.google.de/ -X GET
is parsed successfully.
It would be nice if
httpstat
did not depend on the position of the URL. In my concrete example, the cURL command was generated by Flask-RESTPlus Swagger documentation.The text was updated successfully, but these errors were encountered: