The following passes (taken from https://gatling.io/docs/2.3/http/http_request/, removed .toJSON
as it did not exist), but does not add an entry to the REST API:
class TestREST extends Simulation {
val httpProtocol = http
.baseUrl("http://127.0.0.1:5000") // Here is the root for all relative URLs
val scn = scenario("UploadMany") // A scenario is a chain of requests and pauses
.exec(http("request_1")
.put("/")
.body(StringBody("""{
"text":"lalala", "title": "hello world", "date": "12346"}"""))
.check(status.is(200))
)
setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}
How do you add JSON data to a .put
request with Gatling?