Correlate/save value in response header

I want ot save a uuid in my response header and reuse it in my script. The reponse is:

=========================
HTTP response:
status:
302
headers:
Date: Wed, 23 Mar 2022 12:51:18 GMT
Content-Length: 0
Connection: keep-alive
X-FRAME-OPTIONS: DENY
X-XSS-Protection: 1; mode=block
Content-Security-Policy: img-src ‘self’ data: blob:;font-src ‘self’ data:;
X-EVENT-ID: 6f1a7ee5-d8c6-40a0-9094-cf45c443be5f
Cache-Control: no-cache, no-store, must-revalidate, private, s-maxage=0
Location: https://xxx/site.html#ZjBiMzExYzItNjZlOC00MGVmLWFkZTAtODRmZTRhMjQ4Mzhi/oversikt
Content-Language: nb
Strict-Transport-Security: max-age=15724800; includeSubDomains

<<<<<<<<<<<<<<<<<<<<<<<<<

I want to save the value after

site.html

and before

/oversikt

How can I obtain that?

Location is a header you’ll never see unless you disable followRedirects, which you shouldn’t.
Don’t do that.

Instead, parse the landing url, see currentLocationRegex.

I’ve come across situations where its not just one redirect but multiple. And usually I’ve get same portion of the Location header. Is it possible to use currentLocationRegex on each of these redirects? I tried and it only captured the last redirect. Would it be possible to apply a regex on all the redirects and store the captures in an array? (or have list of regex that apply to corresponding level of redirects)?

Is it possible to use currentLocationRegex on each of these redirects?

No, it’s not possible and I fail to see why it would make sense. Please elaborate.

By default, Gatling behaves like a browser when it comes to redirects, meaning:

  • it follows them transparently (in a browser, your client-side JavaScript code wouldn’t be able to see the intermediate requests either)
  • it takes care transparently of any cookie intermediate requests would set