Question

Following some good feedback on previous issue:

Gatling-tool Extracting cookie data

I have a post request in my gatling simulation which looks like the following:

.post("/checkout/onepage/form_key/${formkey}")

The variable ${formkey} is populated from a cookie value using:

.check(headerRegex("Set-Cookie","CACHED_FRONT_FORM_KEY=(.*)").saveAs("formkey"))

This appears to work correctly, however I now have an issue with:

java.net.URISyntaxException: Illegal character in path at index 90

Obviously I need to escape the special characters in the variable, but I'm unsure of how best to do this.

Gatling does provide a transform function:

https://github.com/excilys/gatling/wiki/Checks#wiki-transforming

I'm hoping I can use this to escape the characters. Any ideas would be greatly appreciated.

Was it helpful?

Solution

Yes, query paremeter parts must be URLEncoded.

In Gatling 1, transform takes a String and returns a String, so you would have something like:

.transform(rawCookieValue => java.net.URLEncoder.encode(rawCookieValue, "UTF-8"))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top