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

**URL:** <https://community.gatling.io/t/status-find-is-201-but-actually-found-400-while-im-trying-post-method-so-what-its-the-solve/7147>\
**Category:** Gatling (Open-Source)\
**Created:** [September 13, 2022, 12:34pm UTC](https://community.gatling.io/t/status-find-is-201-but-actually-found-400-while-im-trying-post-method-so-what-its-the-solve/7147 "2022-09-13T12:34:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajeda](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sajeda](https://community.gatling.io/u/sajeda)\
**Post date:** [September 13, 2022, 12:34pm UTC](https://community.gatling.io/t/status-find-is-201-but-actually-found-400-while-im-trying-post-method-so-what-its-the-solve/7147/1 "2022-09-13T12:34:25Z")

</div>

```scala
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)
}

```

 ![me](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/a/a436543728f53b833f87290096a34d1bfdc9bf19.png)  
thats my script hope you to help me

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [September 13, 2022, 12:50pm UTC](https://community.gatling.io/t/status-find-is-201-but-actually-found-400-while-im-trying-post-method-so-what-its-the-solve/7147/2 "2022-09-13T12:50:34Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 13, 2022, 1:32pm UTC](https://community.gatling.io/t/status-find-is-201-but-actually-found-400-while-im-trying-post-method-so-what-its-the-solve/7147/3 "2022-09-13T13:32:29Z")

</div>

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

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

```

You have an extra double quote before your JSON object!
