Filling parameter in request with value from previous response

'm about to script performance tests for a system with REST interface. I’m looking for a performance tool that let me prepare XHR requests dynamically, i.e. simulate what JavaScript application does. For instance, to request a CSRF token from one REST endpoint and include it in a header of a subsequent HTTP request.

Can I do this with Gatling?

How?

Thank you,
Maciej

Yes, of course.
Just have a look at the documentation.