I am trying to make a POST call:
I have a dynamically generated list of strings:
val resourceList = session(“resourceNames”).as[List[String]].mkString(",")
Now I need to pass this as request body:
.exec(http(“Submit Resources List”)
.post("/my-api-endpoint")
.body(StringBody("""["${resourcesForApp}"]""")).asJSON
.check(status.is(200))
)
Basically the Rest body should look like:
[“resource1”, “resource2”, “resource3”]
But my Java API is reading the request body as a single element in the list seperated by comma instead of reading 3 elements in the list as above.
How to correctly set the body in gatling request?