I’m new to Gatling, working on writing my first scenario. I can’t get RawFileBody to work. I direct all traffic through fiddler so I can see what’s going on and the file content isn’t being outputted to the request body. Using StringBody works fine but I prefer not using it for very large JSON payloads.
I’ve checked that the file is in the “…\gatling\gatling-charts-highcharts-bundle-2.1.4\user-files\bodies” directory, I’ve tried using an absolute path, I’ve tried adding asJSON. I’ve set log levels to trace and haven’t seen any errors or warnings, but the request body is still empty. Here’s the relevant part of the script (ignore any small mistakes as I’ve had to remove lots of proprietary code):
import io.gatling.core.scenario.Simulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import java.util.UUID
class Scenario1 extends Simulation {
val uri1 = "http://somehost"
val httpProtocol = http
.baseURL("http://somehost")
.proxy(Proxy("localhost", 8888).httpsPort(8888))
.inferHtmlResources()
.acceptHeader("application/json")
.contentTypeHeader("application/json")
val header = Map("Some" -> "proprietary-header")
object Foo {
val bar = exec(http("bar")
.post(uri1 + "/app/myservice")
.headers(header)
.body(RawFileBody("my_request.txt")))
}
val scn = scenario("scenario1").exec(Foo.bar)
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
Any ideas?