Saving request data sent to mock server

I am trying to implement the following scenario in the postman.

Scenario:

  1. Setup a mock server

  2. Send a request to the mock server

  3. Access the data received on the mock server

  4. Store that data to a global variable and use it later in the testing

Step 1 and step 2 are done. but stuck at step 3.

How should I access the data from the request sent to the mock server?

1 Like

Can you maybe explain which problem / scenario you are trying to solve?

Hi vdespa,
I havenโ€™t found answer but I am dealing similar usecase keyulpax.

I have setup mock server using postman I call it e.g. by this url {{url}}/get?foo=bar.
If I call requeste from postman it is fine and I can process parameter by โ€œTestsโ€ in Request.
But when the url is called from browser, I canโ€™t use Pre-Request Script or Tests anymore.
The aim is to catch parameters from url directly in response as save it as variable. Is that possible?

Thanks

@tra - you can use scripts and variables only within Postman.