I managed to get it to work (with ChatGPTs help - it does need to be properly trained on Mountebank with more examples etc)
"behaviors": [
{
"lookup": {
"key": {
"from": "path",
"using": { "method": "regex", "selector": "\\/billing\\/v1\\/shipments\\/(.*)\\/transactions\\/(.*)" },
"index": 2
},
"fromDataSource": {
"csv": {
"path": "billing/lookup/errors.csv",
"keyColumn": "BILLING_TRANSACTION_ID",
"delimiter": ","
}
},
"into": "${row}"
}
}
],
Also, it's not clear if escaping is required or not, once I got lookup working, I left it. Would be good if debug mode printed the "match"
Also, would be good if the lookup was actually somehow a predicate, so it can skip stub and move onto next one.. Right now, if the lookup fails, it returns the template with placeholders.
I don't want to use injection mode, so I need to try and get my test data setup as concise as possible.
Next step is to get the predicates to work with regex. Right now, the predicate defeats the purpose of my nice lookup regex.
"predicates": [
{ "equals": { "method": "POST" } },
{ "equals": {
"path": "/billing/v1/shipments/34492b59-4d9d-4912-9efb-5b88f82a1603/transactions/265c13f0-aadd-4980-8966-096c495a38bc"
}
}
]