如何在放心中解决无效的{“ error”:“ invalid_post_type”}响应?

时间:2019-04-22 17:32:40

标签: rest rest-assured

使用编码器配置执行此请求以对我的令牌进行编码:

@Test
void test() {
    //RestAssured.baseURI = "https://slack.com";

    Response getResponse = expect().statusCode(200).given().config(RestAssured.config()
    .encoderConfig(EncoderConfig.encoderConfig().encodeContentTypeAs("x-www-form-urlencoded",ContentType.URLENC))).contentType("x-www-form-urlencoded")
    .formParam("token", "hXNHENcvfIBD049JCmvJ1kS3n6sH+WzVLGsaFbqyQAU/ih76KnsLUf+H1V8FmaURWNwzt1v7fcny9eTDPGpQbiMlRcc40WTyzSThsJrTqDQjb3YJhqTTK22Ujy1Vgwah")
    .formParam("name", "me@12345").when().log().all() .then().log().all().request().post(
    "https://slack.com/api/channels.create");

    System.out.println(getResponse.body().asString());
}

并获得api成功,但体内的响应是

{
    "ok": false,
    "error": "invalid_post_type"
}

0 个答案:

没有答案