Requester icon indicating copy to clipboard operation
Requester copied to clipboard

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

Open igor-kupczynski opened this issue 4 years ago • 2 comments

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 avatar Feb 20 '21 22:02 igor-kupczynski

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?

igor-kupczynski avatar Feb 20 '21 22:02 igor-kupczynski

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

kylebebak avatar May 05 '22 15:05 kylebebak