为x-www-form-urlencoded返回了错误的请求

时间:2017-10-24 13:19:16

标签: java rest api rest-assured

String url =“url here”;

    Response response = RestAssured
            .given()
            .header("Content-Type", "application/x-www-form-urlencoded")
            .header("authorization", "Basic bWFnZWxsYW5JRDo4dkVjQTc2dDhnOTgzQXEz")
            .header("cache-control", "no-cache")
            .header("postman-token", "18dd626d-a059-4fe4-c171-c5742d483c94")
            .formParam("grant_type", "password")
            .formParam("password", "Test123")
            .formParam("scope", "cn openid mail ")
            .formParam("username", "crew")
            .post(url);

    response.prettyPrint();

在JAVA上使用Restassured并尝试生成安全令牌时,它返回了错误的请求。

{     “代码”:400,     “理由”:“不良请求”,     “消息”:“错误请求” }

有人可以帮忙吗。提前谢谢。

0 个答案:

没有答案