Is it possible to extract info about the examples you have defined for a request using the “pm.*” commands in the pre-request tab?
Goal: I have a mock server with a POST request set up and have multiple examples (each of them has a query parameter called “example_name” which is a string, and has a defined value). I want to send different responses back depending on what name the request body contains when the POST request’s endpoint is hit.
For example: If the request contains “example_name: example4” in the body, then I want to return the example which has the query parameter “example_name” set to “example4”.
But I would prefer not to hardcode these name values in the pre-request tab. Is it possible to extract the query parameters for all the examples? Something like “pm.examples.queryParams()” and then get a dictionary like: { “example1” : {“example_name”: “example1”}, … , “example4”: {“example_name”: “example4”}, … } or something similar?