是否可以在Mountebank存根之间共享变量?
这是一个高级示例:
存根A:
{
"predicates": [
{
"matches": {
"body": "amount=420"
}
}
],
"responses": [
{
"is": {
"statusCode": 200
},
"body": {
"transaction_id": "123456",
"amount": 420
},
"_behaviors": {
"copy": [{
"from": {"query": "transaction_id"},
"into": "${TRANSACTION1}",
"using": {
"method": "regex",
"selector": "(?<=transaction_id%5D=).{6}"
}
}]
}
存根B:
{
"predicates": [
{
"matches": {
"body": "approved=420"
}
}
],
"responses": [
{
"is": {
"statusCode": 200
},
"body": {
"transaction_id": "${TRANSACTION1}",
"amount": 420
}
}
我为存根B尝试过的copy _behavior方法似乎无法识别存根A中指定的变量。从文档看,似乎我无法在这些存根之间使用复制。