以下是我的要求,在控制台中,我能够看到要存储在变量中的日志。
RestAssured.baseURI =“ https://www.dummy.com//services”;
RestAssured.given().
headers("data",crypto).
when().
post("//auth.svc/auth").
then().contentType(ContentType.JSON).log().all();
答案 0 :(得分:2)
Response response = RestAssured.given().
headers("data",crypto).
when().
post("//auth.svc/auth").
then().contentType(ContentType.JSON).
extract().response();
然后,您可以使用response.asString()
将响应另存为字符串,或者使用JsonPath对象检查json。例如:
JsonPath jsonPathEvaluator = response.jsonPath();
jsonPathEvaluator.get("xyz");