有些时候,回到下面的代码行,我得到了响应。现在,它给出了错误
不能将java.lang.classCastException:io.restassured.internal.RestAssuredResponseOptionsImpl转换为io.restassured.response.ResponseOptions
下面是我的代码,它以前工作得更早,现在不起作用了:-
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());
}任何帮助都会很感激的。
发布于 2019-07-22 09:56:10
谢谢社区..。这个代码解决了我的问题:-
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();
}https://stackoverflow.com/questions/57142865
复制相似问题