【发布时间】:2018-06-24 20:02:39
【问题描述】:
我正在尝试使用“放心”来访问 API,这是一个带有表单参数客户端 ID、用户和密码的 POST 请求。和多个标题。
我收到 415,不支持的媒体类型错误。我的代码是:
Response res =
given().
.header("Accept", "application/json")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("channel","")
.formParam("grant_type", "password")
.formParam("client_id", "")
.formParam("secret", "")
.formParam("userId", "")
.formParam("password","").
when()
.post("/apiname");
System.out.println(res.body().asString());
返回类型为json。
PostMan 也是如此。请帮忙。
【问题讨论】:
标签: rest api rest-assured rest-assured-jsonpath