【发布时间】:2017-08-25 10:47:03
【问题描述】:
我正在使用 Rest Assured 测试 API
当我发布 authentication 请求时,出现的错误是:"java.lang.IllegalArgumentException: Cannot serialize because cannot determine how to serialize content-type application/x-www-form-urlencoded;charset=UTF-8"
这是我的测试方法
@Test
public void authenticate()
{
AuthenDto authenDto = new AuthenDto("username","password","false","Login");
given()
.contentType("application/x-www-form-urlencoded;charset=UTF-8")
.accept("application/json, text/plain, */*")
.body(authenDto)
.when()
.post("ENDPOINT")
.then()
.statusCode(200);
}
【问题讨论】:
标签: java restful-authentication rest-assured