首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能将io.restassured.internal.RestAssuredResponseOptionsImpl转换为io.restassured.response.ResponseOptions

不能将io.restassured.internal.RestAssuredResponseOptionsImpl转换为io.restassured.response.ResponseOptions
EN

Stack Overflow用户
提问于 2019-07-22 09:21:23
回答 1查看 2.2K关注 0票数 0

有些时候,回到下面的代码行,我得到了响应。现在,它给出了错误

不能将java.lang.classCastException:io.restassured.internal.RestAssuredResponseOptionsImpl转换为io.restassured.response.ResponseOptions

下面是我的代码,它以前工作得更早,现在不起作用了:-

代码语言:javascript
复制
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.serenitybdd.rest.SerenityRest;

static Response response;

public void createAI(){

response = SerenityRest.given().urlEncodingEnabled(false).contentType(ContentType.JSON)
            .auth().oauth2(authToken)
            .log().all()
            .when().body(JsonData)
            .post("/myAccount/category/AI/create")
            .then().extract().response();

    System.out.println(response.asString());
    }

任何帮助都会很感激的。

EN

回答 1

Stack Overflow用户

发布于 2019-07-22 09:56:10

谢谢社区..。这个代码解决了我的问题:-

代码语言:javascript
复制
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.serenitybdd.rest.SerenityRest;

static Response response;

public void createAI(){

response = SerenityRest.given().urlEncodingEnabled(false).relaxedHTTPSValidation().contentType(ContentType.JSON)
            .auth().oauth2(authToken)
            .log().all()
            .when().body(JsonData)
            .post("/myAccount/category/AI/create")
            .then().log().all().extract().response();

    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57142865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档