I writing an automation code in rest assured but it return 400 Bad Request and I don't know how to debug it. Hope someone can help.
In postman, i must specify the username and password using raw approach. It will fail on form-data. How to specify raw data in rest-assured?
Curl:
curl --location --request POST 'http://127.0.0.1:8010/api/v1/account/webapi/account/users/secure/webEncryptLogin?checkHash=false%0A' \
--header 'device_token: wap' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "peter1",
"password": "SomeSecretPassword"
}'
Rest Assured Java Code:
given().
contentType("application/json").
queryParam("checkHash", "false").
header("device_token", "wap").
params("username", "peter1", "password","SomeSecretPassword").
when().
post("http://127.0.0.1:8010/api/v1/account/webapi/account/users/secure/webEncryptLogin").
then().
log().ifError().
assertThat().
statusCode(200);
Questions:
Change params to body() method