Http 400 bad request

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:

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

0005_request.dat file content:

{"stateToken":"${stateToken}"}

Error message is as below:
body:

{"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

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.

1 Like