scala - List in request body in Gatling -


i trying make put call via gatling , trying pass list request body:

.put("/mypath").body(list(session("usernames")).asjson.check(status.is(200)) 

where have usernames in session , list of strings.

body should become: ["string1", "string2"....]

any solution on how pass list request body. new gatling. please help.

try this:

.put("/mypath") .body(stringbody("${usernames.jsonstringify()}").asjson) .check(status.is(200)) 

jsonstringify part of expression language (el) , turns list json string. .asjson @ end ensures content-type set correctly application/json.


Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -