-
Notifications
You must be signed in to change notification settings - Fork 329
Feature proposal: saving current request setup under named alias #70
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
Comments
I like your idea of saving a state, but I think the user interface could be better. This tool tries hard to mimic the Unix/Linux shell environment, but # Print the current state
http://127.0.0.1> env
username==testuser
password==testpassword
# Export the current state to a file
http://127.0.0.1> env > state.txt
# Import state from a file
http://127.0.0.1> source state.txt |
You're right @eliangcs , that would be even better. |
I've started working on the What's been done:
What needs to be done:
The dilemma I'm facing now is how should I implement the May I ask for some feedback @eliangcs , please? |
@fogine Thank you very much for taking the effort to do this! I think when a user does cd http://example.com
name=abc
query==foo
Content-Type:application/json When a user does http://localhost> cd http://example.com
http://example.com> name=abc
http://example.com> query==foo
http://example.com> Content-Type:application/json I agree we should output all context data, no matter we're writing to a terminal or a file. So if a user does http://example.com> env
cd http://example.com
name=abc
query==foo
Content-Type:application/json Does it make sense? |
@eliangcs , you provided excellent contribution guide and therefore eased the process of starting out for me, thanks! The way how you described the
contents of cd http://someurl.com
name=abc
query==foo the http://localhost> env
cd http://localhost
bar=baz
http://localhost> source ./abc.txt
http://someurl.com> env
cd http://someurl.com
name=abc
query==foo
bar=baz # !!! we would have to execute `rm *` before the `source` command so that the `bar` parameter wouldn't have been included... which is cool but a man gets bored quickly of having to type too much :) that's why we should consider introducing another command
|
@fogine I think The file path should be relative to the current working directory. When we have shell command support (WIP in #61), we can do something cool like: > value=="a very long string"
> env > ./out.txt
# Compute sha1 hash of 'value' in shell, and assign back to querystring parameter 'value_sha1'
> value_sha1==`cat ./out.txt | grep value | sed "s/^value==//g" | sha1sum` |
As I've been implementing the Any thoughts about the issue, @eliangcs ? |
@fogine I agree with you. Automatic context saving should happen only when |
@eliangcs , I've updated the list HERE so it reflects current state of the development. All discussed features have been implemented (with additional output redirection option eg.: httpie post someurl | tee /tmp/test # is highlighted as incorrect
httpie post bar=baz > /tmp/test # is highlighted as incorrect
post > /tmp/test # is also highlighted as incorrect I made few attempts which I expected to work (but they didn't)... |
The |
@fogine Cool! Sorry I didn't reply you earlier. I'm looking forward to using this new feature! |
@eliangcs , I'm trying to run tests for all python versions via the
In the contribution guide you mention:
Do I understand correctly that the My
and I've installed the Do you have an idea what am I doing wrong? |
@fogine tox should be installed on one of your pyenv's Python versions. Try doing this: $ cd /path/to/http-prompt
$ pyenv deactivate
$ pyenv local 3.5.1 3.4.4 3.3.6 2.7.11 2.6.9 pypy-5.0.0 pypy3-2.4.0
$ pip install tox
$ tox If you run |
I've uninstalled system wide path/to/http-promptt> which python
~/.pyenv/shims/python
path/to/http-prompt> python --version
Python 3.5.1 # the version is the version from the http-prompt virtualenv
path/to/http-prompt> which pip
~/.pyenv/shims/pip
path/to/http-prompt> pip install tox
path/to/http-prompt> tox
but when I run the last command ( |
The way how I installed the
@eliangcs , could you please explain further to me what does it exactly mean to NOT be in a virtualenv. Until now I've thought it means using system wide python installation |
@fogine I guess your pyenv/tox setup is ok. The problem is that I'll edit that part of contribution guide to avoid confusion. Thanks for pointing that out! |
@eliangcs, I completely forgot that it was me who has started using the |
This is great package, thanks for sharing your work!
As I've been using it couple of days I noticed that it's quite inconvenient, having to repeatedly change request settings every time I want to send different request.
The option of saving current state of request would solve the problem.
Given this output of
httpie post
:http://127.0.0.1:3000/api/oauth/token> http --form --style native POST http://127.0.0.1:3000/api/oauth/token user_id==value client_id=value client_secret=value grant_type=password password=test username=testuser1 Content-Type:application/x-www-form-urlencoded
We could use eg.:
http://127.0.0.1:3000/api/oauth/token> alias getToken
which would save the request under
getToken
keyword. Later, we could call getToken request and optionally overwrite any req options like so:http://127.0.0.1:3000/api/oauth/token> getToken username=testuser2 password=test2
The text was updated successfully, but these errors were encountered: