Our API sequence is A->B
1step: extract API A’s discountPremuim and set it to session
.check(jsonPath("$[0].discountPremium").optional.saveAs("discountPremium"))
2step: API B’s json feeder use this discountPremuim
{
...
"discountPremium": #{discountPremium},
...
}
But API A may not respond the discountPremuim if goods don’t have the discount.
I try use
.exec(_.set("discountPremium",null.asInstanceOf[Any]))
to set it to null or directly set it to null, but Failed to build request: Attribute discountPremium’s value is null
here’s what I want
"discountPremium": #{discountPremium.exist()?discountPremium:null},
I can not find the Gatling EL’s ternary operator on the gatling.io
how can I do? many thanks