小编Tri*_*yen的帖子

请放心 - 无法序列化,因为无法确定如何序列化内容类型

我正在使用Rest Assured 来测试API

当我发布身份验证请求时,出现错误:"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);
}
Run Code Online (Sandbox Code Playgroud)

java restful-authentication rest-assured

6
推荐指数
2
解决办法
6368
查看次数