scala - Gatling2: How can I read from the virtual user's session -
i realise can save response body in virtual user's session:
  val session: session = session("myscn", "123")   val scn = scenario("myscn")     .exec(http("my_request")     .post(serverurl)     .headers(headers)     .body(inputstreambody(helper.getbytearrayinputstream))     .check(status.is(200), bodybytes.saveas("responsebody")))     //key not found...    session("responsebody").as[bytearray] how can read responsebody (implicit?) sesssion? created explicit session well...
edit:
based on answer have clarified scenario. in answer not know how function transformbytes works.
either pass function gatling dsl method:
.body(bytearraybody(session => session("responsebody").validate[array[byte]].map(transformbytes))) or in exec block , store transformation result in new attribute
exec { session =>    session("responsebody").validate[array[byte]]     .map(transformbytes)     .map(newbytes => session.set("newbytes", newbytes)) } beware might want remove original bytes session don't linger long in memory , end in old gen.
Comments
Post a Comment