Issue with Http Protocol Builder?

Hi All,

I am using gatling 2.0.0-M3a I found a weird issue that I wanted to share. I have a situation where I need to use baseURL or baseURLs based on some flag. There are two ways I tried building the httpProtocol.

Way 1:

val httpProtocol =
if (System.getProperty(“baseURL”) != null) {
http.baseURL(System.getProperty(“baseURL”))
} else {
val urls = System.getProperty(“baseURLs”) split “,”
val (arr1, arr2) = urls.splitAt(2)
http.baseURLs(arr1(0), arr1(1), arr2: _*)
}

httpProtocol

.acceptCharsetHeader(“ISO-8859-1,utf-8;q=0.7,*;q=0.7”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3”)
.disableFollowRedirect
.disableResponseChunksDiscarding
.extraInfoExtractor(ex)

Way 2:

val httpProtocol =
if (System.getProperty(“baseURL”) != null)
http.baseURL(System.getProperty(“baseURL”))
.acceptCharsetHeader("ISO-8859-1,utf-8;q=0.7,;q=0.7")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3”)
.disableFollowRedirect
.disableResponseChunksDiscarding
.extraInfoExtractor(ex)
else {
val urls = System.getProperty(“baseURLs”) split “,”
val (arr1, arr2) = urls.splitAt(2)
http.baseURLs(arr1(0), arr1(1), arr2: _
)
.acceptCharsetHeader(“ISO-8859-1,utf-8;q=0.7,*;q=0.7”)
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3”)
.disableFollowRedirect
.disableResponseChunksDiscarding
.extraInfoExtractor(ex)
}

The problem is when I build httpProtocol by Way 1, the extraInfoExtractor is never called during simulation. However, when I build is using Way 2, it gets called. Is there any reason why Way 1 can not work?

Thanks and Regards,
Sandeep

We are using immutable values.
So, when doing:

val httpProtocol = …

httpProtocol

.xxx

All the changes produced by .xxx are lost.
Do you get it?

nicolas