status.find.in(200,201,202,203,204,205,206,207,208,209,304), found 415 for post request

85 views
Skip to first unread message

Toh Lay Mui

unread,
Jan 11, 2022, 8:34:39 AM1/11/22
to Gatling User Group
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

Stéphane LANDELLE

unread,
Jan 11, 2022, 8:41:04 AM1/11/22
to gat...@googlegroups.com
Missing Content-Type header
--

Stéphane Landelle

Chief Technical Officer

   

slan...@gatling.io
gatling.io
   
facebook twitter linkedin 


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/76fb4259-e515-4143-a666-81023a14becfn%40googlegroups.com.

Toh Lay Mui

unread,
Jan 12, 2022, 1:31:48 AM1/12/22
to Gatling User Group
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"))

Toh Lay Mui

unread,
Jan 12, 2022, 1:31:51 AM1/12/22
to Gatling User Group
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")

On Tuesday, 11 January 2022 at 21:41:04 UTC+8 Stéphane Landelle wrote:
Reply all
Reply to author
Forward
0 new messages