Using filebody with JSON

Hi I’m trying to call a post request using the filebody, but i get an exception.

value fileBody is not a member of io.gatling.http.request.builder.PostHttpRequestBuilder

possible cause: maybe a semicolon is missing before `value fileBody’?

here is my code:

class testPost extends Simulation{
val httpProtocol = http
.baseURL(“baseURL”)
val scn = scenario(“test”)
.exec(http(“test”)
.post(“service”)
.fileBody(“test.json”).asJSON)
setUp(scn.inject(ramp(10 users) over (10 seconds)))
.protocols(httpProtocol)
}

I have the json file in the request-body folder.

please help!

Thank you,
Will

Hi,

You’re trying to use Gatling 2 with Gatling 1 syntax.
See https://github.com/excilys/gatling/wiki/Gatling%202#wiki-bodies

Cheers,

Stéphane

so simple, Thanks!