简体   繁体   中英

accessing session variable inside a response transformer in gatling

I have a basic question for which I don't seem to be able to find the answer. How can I access session variables inside a response transformer? Something like:

.transformResponse {
      case response if response.isReceived =>
        new ResponseWrapper(response) {
          session??
          override val body = new ByteArrayResponseBody("", UTF_8)
        }
    };

There is no Session object in context of that partial function, so you can't access it. What do you want to achieve? Maybe check(bodyString.transform()) would be better solution as it can take (String, Session) => T as parameter so you can access session attributes in that function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM