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

Feature suggestion: allow "manual" (or step-by-step) chaining of the requests #31

Open
igor-kupczynski opened this issue Feb 20, 2021 · 2 comments

Comments

@igor-kupczynski
Copy link

The docs specify how to chain requests:

get('http://httpbin.org/get')
get('http://httpbin.org/cookies', cookies={'url': Response.json()['url']})

or

get('httpbin.org/get', name='first_response')
get('google.com', allow_redirects=False)
get('httpbin.org/cookies', cookies={'url': first_response.json()['url']})

The problem is that you have to:

  1. Select all of the requests
  2. ⌘⇧P and Reuqester: Run Requests Serially.

If you want to run them one-by-one you'll get:
image

I think I understand why is the -- env is per run if you run the requests one by one then the second run has a separate env, without the Response.

It would be nice to allow some form of persistent for such exploratory runs when you just prefer to run the script one-by-one. What do you think?

@igor-kupczynski
Copy link
Author

Also, when you try to export such file to curl it fails :(
image

Do you think this can be fixed? Do you have any hints on how to do that?

@kylebebak
Copy link
Owner

kylebebak commented May 5, 2022

I think I understand why is the -- env is per run if you run the requests one by one then the second run has a separate env, without the Response.

This is exactly right. It might be possible to add another arg, like persist_response, that ensures the named response is in memory that's shared across Requester calls, and can be referenced in future Requester calls

A simpler option is not sharing memory across Requester calls, but serializing response object with something like pickle so it can be written to disk and pulled into memory on a future call

I think this is an edge case, but would be valuable for "exploratory runs" as you suggest. PR welcome

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

2 participants