I'm a fresh newbie to Gatling. I'm trying to send a POST message to an HTTP API using Gatling. I tried the following:
package app.basic
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class basicPost extends Simulation {
val headers_10 = Map("Content-Type" -> """application/json""")
object Post {
// repeat is a loop resolved at RUNTIME
val post = repeat(50) {
exec(http("Post Data")
.post("/data")
.queryParam("""size""", "10"))
.headers(headers_10)
.body("""{"id1":"0000000000"}""")
.pause(1)
}
}
val httpConf = http.baseURL("http://amazonperf-env.elasticbeanstalk.com")
val users = scenario("Users").exec(Post.post)
setUp(
users.inject(rampUsers(1000) over (10 seconds))
).protocols(httpConf)
}
However, I get this error when compiling: value body is not a member of io.gatling.core.structure.ChainBuilder possible cause: maybe a semicolon is missing before `value body'?
How do I specify the body of the message that I want to send?
This is old Gatling 1 syntax (Gatling 1 is deprecated and no longer maintained).
Please read the documentation.
In you case, you'd get something like:
.body(StringBody("""{"id1":"0000000000"}"""))