gatling-maven-plugin does not send POST body when EL expressions are used?

Hi everyone,

I have observed a strange discrepancy in behavior between running a scenario via standalone Gatling (3.3.1) vs. via the gatling-maven-plugin (3.0.5). It seems that the gatling-maven-plugin does not send the request body when using EL expressions in the body. The result is correct if I manually use Scala’s string interpolation instead. Is this a bug, or am I doing something wrong?

Here is a minimal example:

`
package com.example

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.protocol.HttpProtocolBuilder
import scala.concurrent.duration._

class PostBodyTest extends Simulation {
private val httpProtocol: HttpProtocolBuilder = http.baseUrl(“http://localhost:8080”)
private val feeder = Iterator.continually(Map(“someID” → 42))

private val scn = scenario(s"automatic vs manual interpolation")
.feed(feeder)
.exec(
http(“Send message v1”)
.post(s"/v1")
.body(StringBody(session => s"someID=${session.attributes.get(“someID”).get}"))
)
.exec(
http(“Send message v2”)
.post(s"/v2")
.body(StringBody(“someID=${someID}”))
)

setUp(
scn.inject(
constantUsersPerSec(1) during (1 seconds)
).protocols(httpProtocol)
)
}
`

Set in your logback-test.xml to view the request details.

When running via standalone Gatling 3.3.1, I see the following HTTP requests in the logs:

POST http://localhost:8080/v1
headers=
accept: /
host: localhost:8080
content-length: 9
stringBody=someID=42

POST http://localhost:8080/v2
headers=
accept: /
host: localhost:8080
content-length: 9
byteArraysBody=someID=42

However, when running via gatling-maven-plugin 3.0.5, I see the following HTTP requests in the logs:

HTTP request:
POST http://localhost:8080/v1
headers=
accept: /
host: localhost:8080
content-length: 9
stringBody=someID=42

HTTP request:
POST http://localhost:8080/v2
headers=
accept: /
host: localhost:8080
content-length: 0
stringChunksRequestBody=someID=42

As you can see, v1 is still correct but v2 now has a content-length of zero. I can confirm that there is actually no POST body being received by the other end for v2 either: i.e. even though it says “stringChunksRequestBody=someID=42”, there is actually no body being sent and “content-length: 0” is therefore correct.

Any thoughts?

Absolutely.
Contrary to what you stated, you don’t use Gatling 3.3.1 in your maven project, but Gatling 3.4.0-M1, which is an unstable milestone you shouldn’t be using.
There’s a known regression there: https://github.com/gatling/gatling/issues/3900

Please revert to stable/official 3.3.1.

Thanks Stéphane!

I did have dependency gatling-charts-highcharts with version 3.4.0-M1 in my pom, but I wrongly assumed that this only referred to the visualization part and that the maven plugin pulled in the Gatling engine itself.
Using gatling-charts-highcharts 3.3.1 with gatling-maven-plugin 3.0.5 indeed works as expected.