getting 302 while using a POST method in rest assured -


i have written test case below , got below error,

error in log:

failed: setpassword java.lang.assertionerror: 1 expectation failed. expected status code <200> <302>.

code:

@test(enabled=true)  public void setpassword(){     requestspecification requestspecification= new config().getrequestspecification();     requestspecification requestheaders= new config().getheaders();      map<string,string> password = new hashmap<string, string>();     password.put("password", "password@2017");         given().spec(requestspecification).spec(requestheaders).body(password).when().post("https://example.com/testplatform@example.com/password").     then().statuscode(200).log().all();   } 

i solved issue. getting 302 error because api url getting encoded. used urlencodingenabled(false) , solved issue.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -