[英]How to convert a Gatling jsonFeeder with nested structures to json request body?
我有一个 json feeder 从文件中读取一个 json 数组,如下所示:
[{ "a": {"b": 1} }, { "a": {"b": 2} }]
当我将它用于请求正文时,它会像ArraySeq(HashMap(..
而不是实际的 json。
val jsonFileFeeder = jsonFile("requests.json").circular
val scn = scenario("cost estimation")
.feed(jsonFileFeeder)
.exec(
http("request_1")
.post("/")
.body(StringBody(
"""{
"a": "${a}"
}"""
)).asJson
)
使用jsonStringify()
,请参阅文档。
val jsonFileFeeder = jsonFile("requests.json").circular
val scn = scenario("cost estimation")
.feed(jsonFileFeeder)
.exec(
http("request_1")
.post("/")
.body(StringBody(
"""{
"a": "${a.jsonStringify()}"
}"""
)).asJson
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.