Request body is:-

{
"request":
{
  "body": 
{
    "ABC":["XYZ"],
    "PASSWORD": "password"
  }
}

MY CODE:-

I am getting error in response because the ABC value is going in string format

    Map body = new LinkedHashMap(6);
    body.put("ABC","XYZ");
    body.put("PASSWORD","password");

what is the correct way to write this request body using LinkedHashMap in restAssured

"ABC":["XYZ"],

1

There are 1 best solutions below

0
lucas-nguyen-17 On BEST ANSWER

You just need change it to List<String>

body.put("ABC", Arrays.asList("XYZ"));