here is my code snippet for the post request
object Create {
val newMessage = exec(http(“Create New Message”) // Here’s an example of a POST request
.post("/taqelah/messages/")
.body(StringBody("""{ “author”: “CB”, “message”: “Speaking in tongue” }""")))
}
val messageFeeder = csv(“message.csv”).random
val scn = scenario(“CRUD on Message”)
.exec(Get.getByID)
val user = scenario(“Normal_Users”) // For user
// .exec(Get.getByID)
.exec(Create.newMessage)
.feed(messageFeeder)
here is my github repo
https://github.com/LayMui/restapi-gatling
Missing Content-Type header
I got the error
message.scala:14: value header is not a member of String
possible cause: maybe a semicolon is missing before value header
?
one error found
here is the code snippet:
class message extends Simulation{
val config = ConfigFactory.load()
val httpConf = http
.baseUrl(config.getString(“MESSAGE_BASE_URL”)
.header(“Content-Type”, “application/json”))
got it work
with the code snippet
class message extends Simulation{
val config = ConfigFactory.load()
val httpConf = http
.baseUrl(config.getString(“MESSAGE_BASE_URL”))
.header(“Content-Type”, “application/json”)