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

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -