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

multiple querystring params ignored #20

Closed
jgelens opened this issue May 23, 2016 · 7 comments
Closed

multiple querystring params ignored #20

jgelens opened this issue May 23, 2016 · 7 comments

Comments

@jgelens
Copy link

jgelens commented May 23, 2016

Httpie supports sending multiple querystring args with the same key. http-prompt uses a dict behind the scenes and therefore only calls Httpie with a single value:

http://localhost:6543/testing> httpie get par==1 par==2
http GET http://localhost:6543/testing par==2

This should result in:

http://localhost:6543/testing> httpie get par==1 par==2
http GET http://localhost:6543/testing par==1 par==2
@eliangcs
Copy link
Contributor

eliangcs commented May 24, 2016

I did it on purpose because I was considering the following scenario:

> par==1 par==2
> par==3
> httpie

The current implementation would output http http://localhost par==3. But if I changed the implementation so that it outpus http http://localhost par==1 par==2 page==3, how does a user update an existing querystring parameter? I did not spend too much time thinking of a good design for this, so I just assume users wouldn't have multiple querystring parameters with the same name.

@Zaijo
Copy link

Zaijo commented May 25, 2016

@jgelens When trying to accomplish what you intend I usually type httpie <method> or just httpie into http-prompt, copy the result, add the repeating param and run httpie itself.

@twz123
Copy link

twz123 commented May 29, 2016

I also noticed this issue. Since rm is there to remove no longer wanted parameters, why not adding a comparable command like append to add additional values to an existing parameter? When thinking about it, then rm would also need to support the removal of single values from a parameter in addition to the removal of the whole parameter.

@eliangcs
Copy link
Contributor

@twz123 thanks for your suggestion, but append command doesn't seem beautiful to me. All of the existing commands, such as cd and rm, are borrowed from Unix commands. If I were to add a new command, I want it to be like a Unix command as well. Until we come up with a satisfying design, I guess you can use the workaround that @Zaijo suggested.

@eliangcs
Copy link
Contributor

eliangcs commented Jun 21, 2016

I think we can follow httpie's design. When we have multiple assignments in the same line, it should create multiple values for that parameter. For instance:

> rm *
> par==1 par==2
> httpie
http http://localhost par==1 par==2

And if the assignment is done in a separate line, the parameter is overwritten by the last line entirely. For instance:

> rm *
> par==1 par==2
> par==3 par==4
> httpie
http http://localhost par==3 par==4

@jgelens does this solution work for you?

@jgelens
Copy link
Author

jgelens commented Jun 21, 2016

Sounds great :-)

@eliangcs eliangcs added the todo label Jul 18, 2016
eliangcs added a commit that referenced this issue Jul 18, 2016
eliangcs added a commit that referenced this issue Jul 18, 2016
@eliangcs
Copy link
Contributor

Released with v0.4.2. Please upgrade it with:

$ pip install -U http-prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants