I am pretty new to restassured for post request i am getting below error
java.lang.IllegalStateException: You can either send form parameters OR body content in POST, not both!
Here is my test
public void createModel() {
JSONObject obj2 = new JSONObject();
obj2.put("name", "hello1234");
List<JSONObject> list1 = new ArrayList<JSONObject>();
list1.add(obj2);
System.out.println(" i am list 1 " + list1);
JSONObject obj = new JSONObject();
obj.put("modes", list1);
System.out.println("i am a object \n" + obj.toString());
System.out.println("testtest " + obj);
Response response = httpRequest.auth().preemptive().basic("test", "test")
.given().contentType("application/json").body(obj.toString()).when().post("/modes").then().using()
.extract().response();
int statusCode = response.getStatusCode();
System.out.println(statusCode + " this is post");
System.out.println("This is body" + response.getBody().prettyPrint());
}
I am using RestAssured 3.0.2 dependency It was really working fine suddenly it giving error, any help would be appreciated