I’m not 100% I follow what you are trying to do, but you could possibly run the first call in a pre-request script and then grab the data from there, you could then pass the data into the request body and submit it in the same call.
This would be done using pm.sendRequest.
If I understand your approach correctly, you would create one request, which calls another request in the pre-request script to fetch the data?
My problem is, that I get data passed via the request body. Then I need to modify this data and then returning it back via the response body.
Let’s assume we have a request x, which returns the modified data. In order to work, the request x needs the data passed to modify it.
So with your idea, we would call the request x in the pre-request script and fetch the result and then passing it to the response-body of the original request. But this will not work, because the request x needs the data in the request-body, which at this moment we don’t have, because it is passed with the original request.
To summarize my task:
I need to create a mock server, which simulates signing a xml-file (base64). Basically, I get the base64 passed via the request and need to add the signature to the file. To make things easier, I always add the same hard-coded string signature to the file. After this step, I need to return the signed base64 file with the response header. Is this even possible with postman (with one request)?