Perform custom code on saved response

Hello!

I want to save a response body which is a json and then perform some business logic on it (e.g. get rental prices, choose random one, calculate annual cost) before I make next request with this data.

Tell me please, is it possible to create custom method which I can execute after making gatling native http request? Any examples will be very helpful.

Best regards.

check(bodyString.saveAs(“body”))

then an exec(function) where you fetch back the saved body.

https://gatling.io/docs/current/http/http_check/#http-response-body
https://gatling.io/docs/current/general/scenario/#exec
https://gatling.io/docs/current/session/session_api/