Hi all,
I have 2 requests say A1 and A2
In req A1
I Have something like
val *A1*: ChainBuilder = exec(http("")
.post("endpoint")
.headers(headers)
.body(StringBody("""{"key":id}"""))
.check(jsonPath("""$..Id""").saveAs("Id"))
.check(status.is(200)))
.exec(session => {
println()
session
})
Now I want that req A2 is build only if key Id has some value
I am trying
val *A2*: ChainBuilder = {doIf(!"${Id}".isEmpty) {
exec(http("")
.post("endpoint")
.headers(headers)
.body(StringBody("""{"key":id}"""))
.check(jsonPath("""$..Id""").saveAs("Id"))
.check(status.is(200)))
.exec(session => {
println()
session
})'
}
This does not work as intended and even if the session variable Id is empty , it works.
Now I think it might be because the if condition is checking the value as string and not the session variable
I am definitely missing something
Could someone suggest a way to achieve the requirement
Thanks