# Http 400 bad request

**URL:** <https://community.gatling.io/t/http-400-bad-request/8864>\
**Category:** Gatling (Open-Source)\
**Created:** [April 5, 2024, 9:50am UTC](https://community.gatling.io/t/http-400-bad-request/8864 "2024-04-05T09:50:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumankumari](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@sumankumari](https://community.gatling.io/u/sumankumari)\
**Post date:** [April 5, 2024, 9:50am UTC](https://community.gatling.io/t/http-400-bad-request/8864/1 "2024-04-05T09:50:25Z")

</div>

Hello,  
Application can be launched after login through okta.I am getting 400 bad request error in gatling before I enter okta login credentials.

```
val headers_5 = Map(
	"accept" -> "application/ion+json; okta-version=1.0.0",
	"accept-encoding" -> "gzip, deflate, br, zstd",
	"accept-language" -> "en",
	"content-type" -> "application/ion+json; okta-version=1.0.0",
	"Content-Length" -> "4720",
	//"Cookie" -> "t=default; DT=${DT}; JSESSIONID=${JSESSIONID}",
	"Host" -> "application.okta.com",
	"origin" -> "https://application.okta.com",
	"sec-fetch-dest" -> "empty",
	"sec-fetch-mode" -> "cors",
	"sec-fetch-site" -> "same-origin",
	"sec-ch-ua" -> """Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123""",
	"sec-ch-ua-mobile" -> "?0",
	"sec-ch-ua-platform" -> "Windows",
	"sec-ch-ua-platform-version" -> "15.0.0",
	"x-okta-user-agent-extended" -> "okta-auth-js/7.0.1 okta-signin-widget-7.16.1")

```

RequestBody:

```java
.exec(http("Login_06_Introspect")
  .post("/idp/idx/introspect")
  .headers(headers_5)
  .body(ElFileBody("application/login/0005_request.dat"))
)

```

0005\_request.dat file content:

```json
{"stateToken":"${stateToken}"}

```

Error message is as below:  
body:

```json
{"version":"1.0.0","messages":{"type":"array","value":[{"message":"The request body was not well-formed.","i18n":{"key":"E0000003"},"class":"ERROR"}]}}

```

I have captured stateToken from previous request. Also, compared previous request’s responses from gatling and browser, couldn’t find any difference.  
Please help to fix it.

Application: Web application

---

<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:** [April 7, 2024, 1:08pm UTC](https://community.gatling.io/t/http-400-bad-request/8864/2 "2024-04-07T13:08:50Z")

</div>

Lower the logging level to debug. There’s a good chance your `stateToken` is not what you think it is and it actually contains characters that break the JSON syntax.

Note: the `${}` Gatling Expression Language has been deprecated for removal years ago in favor of `#{}` and will finally be dropped in the upcoming 3.11 release.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [May 7, 2024, 1:09pm UTC](https://community.gatling.io/t/http-400-bad-request/8864/3 "2024-05-07T13:09:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
