M
M
Michael2022-01-07 17:17:15
API
Michael, 2022-01-07 17:17:15

How to generate dynamic response Postman Mock server?

Hello!

To conduct tests, I need to make a mock server. The server must accept the external request, generate an ID (UUID) for it, and return a response that includes this ID. The id must be new in every response from my mock server.

To implement the task, I chose Postman, where I successfully created a mock-server, from which I can receive a response. But in this answer, it is required to hardcode all the fields in advance, which does not completely solve my problem.

My question is, is there any way to generate Postman mock-server response fields after receiving a request? Is there something like a "Pre-request script" tab that would allow me to collect the response depending on the request.

PS: The question concerns not only UUID, but also access to request fields from a mock-server in general - is there any way to build an if block on the request fields and generate a response depending on what came in?

I hope I explained everything clearly) All the best and Happy New Year!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2022-01-07
@1na1

The answer to the question of how to generate a UID is found here .
The question "How to refer to request fields when generating a response?" is still relevant. I will be glad for any information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question