Is it possible to capture a value from the expression and use that to return specific data? Like a regex capture?
For example, I have this simple mock that returns an array of data that's contained in a file
"expression": "api\/solutions"
"response": {
"file": "data/solutions-list.json"
}
Each item in the array has a GUID associated with it. This GUID is used in other API calls, for example this returns an svg for that specific GUID:
api\/solutions\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})\/svg
I'd like to be able to mock it so that the correct svg file is returned based on the GUID in the expression. For example, I could have the response for a file:
"expression": "api\/solutions\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})\/svg"
"response":{
"file": "data/%GUID%.svg"
}
Where %GUID% is the captured GUID from the expression.
Is this possible or is there another way I missed that I can do this?
Is it possible to capture a value from the expression and use that to return specific data? Like a regex capture?
For example, I have this simple mock that returns an array of data that's contained in a file "expression": "api\/solutions" "response": { "file": "data/solutions-list.json" }
Each item in the array has a GUID associated with it. This GUID is used in other API calls, for example this returns an svg for that specific GUID: api\/solutions\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})\/svg
I'd like to be able to mock it so that the correct svg file is returned based on the GUID in the expression. For example, I could have the response for a file: "expression": "api\/solutions\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})\/svg" "response":{ "file": "data/%GUID%.svg" }
Where %GUID% is the captured GUID from the expression.
Is this possible or is there another way I missed that I can do this?