Status.find.is(201), but actually found 400 while im trying post method so what its the solve?

package com.gatling.tests.api

//import io.gatling.core.scenario.Simulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._





class postapi11 extends Simulation{
  //prtocol
  val httpProtocol = http
    .baseUrl("https://reqres.in/api")
  //scenario
  val scn11 = scenario("Create User")
    .exec(
      actionBuilder = http("create user req  ")
        .post("/users") //end point
        .header(name="content-type",value="application/json" )
        .asJson
        .body(StringBody(
          """"
            |{
            |    "name": "morpheus",
            |    "job": "leader"
            |}
            |""".stripMargin)).asJson
        .check (status is 201 ,
          jsonPath("$.name") is "morpheus"


        )
    )
  //setup
  setUp (
    //scn.inject(atOnceUsers(users = 10))
    scn11.inject(rampUsers(users = 5).during(5))
  ).protocols(httpProtocol)
}


thats my script hope you to help me

Hi @sajeda,

What do you want from the gatling community?

The code feels right.
The results is correct.
Your server answer with a 400 but your simulation expects a 201.

Nothing the gatling community can do for you.
You’ll have to ensure that your body is expected from your server.

Note: no need to manually add the content-type header when you use asJson.

Cheers!

400 means “bad Request”, typically meaning your JSON payload is malformed.

.body(StringBody(
          """" <= 4 doubles quotes here, instead of 3!!!
            |{
            |    "name": "morpheus",
            |    "job": "leader"
            |}
            |""".stripMargin))

You have an extra double quote before your JSON object!