It should work, even if I’d rather write if this way:
val test = exec(http("test url")
.get("test url")
.check(status.in(200, 401).saveAs("responseCode"))
.checkIf(session => session("responseCode").as[Int] == 200) {
jsonPath("$[?(@.fullAccess==true)].id").optional.saveAs("test1")
jsonPath("$..id").optional.saveAs("test2")
jsonPath("$[-1:].name").optional.saveAs("test3")
}
)
If it doesn’t work, please provide a reproducer as instructed here: How to Ask a Question - #2.