Rest 在Mulesoft的BAT CLI中的API URL中注入自定义值
我在Mulesoft中使用BATCLI编写函数API测试- 我试图将URL中的API调用响应中获得的值用于另一个后续API调用Rest 在Mulesoft的BAT CLI中的API URL中注入自定义值,rest,api,automated-tests,functional-testing,mulesoft,Rest,Api,Automated Tests,Functional Testing,Mulesoft,我在Mulesoft中使用BATCLI编写函数API测试- 我试图将URL中的API调用响应中获得的值用于另一个后续API调用 import * from bat::BDD import * from bat::Assertions import * from bat::Mutable var context = HashMap() --- it ("capture a value from a API response") in [ GET https://first.api.cal
import * from bat::BDD
import * from bat::Assertions
import * from bat::Mutable
var context = HashMap()
---
it ("capture a value from a API response") in [
GET https://first.api.call/abc,
execute [
// This works
context.set('myVal',$.response.body.myVal)
]
],
it ("use the value in the second API URL") in [
// I am trying to inject the value obtained above in the URL below
GET https://first.api.call/{context.get('myVal')}
....
]
显然,我没有得到正确的语法<代码>{context.get('myVal')}不起作用。我还尝试了$({context.get('myVal')})
,$(context.get('myVal'))
,但也不起作用
谁能告诉我正确的语法是什么吗?这很有效:
GEThttps://first.api.call/$(context.get('myVal'))
干杯