是否可以从响应对象中提取方法名称?
Is it possible to extract the method name from the response object?
我在 Java 中使用 REST-Assured,这是我获取 response
对象的方式:
Response response = RestAssured.given().contentType(ContentType.JSON).header(header_name).get();
我想知道是否有任何方法可以从 response
对象中提取使用的方法名称(在本例中为 GET
)。
如果您有兴趣了解请求的方法,请说 GET 或 POST,下面的代码将在控制台上打印该方法
given().log().method()
.when()
.get("https://www.google.co.in/").then().statusCode(200);
希望对您有所帮助
我在 Java 中使用 REST-Assured,这是我获取 response
对象的方式:
Response response = RestAssured.given().contentType(ContentType.JSON).header(header_name).get();
我想知道是否有任何方法可以从 response
对象中提取使用的方法名称(在本例中为 GET
)。
如果您有兴趣了解请求的方法,请说 GET 或 POST,下面的代码将在控制台上打印该方法
given().log().method()
.when()
.get("https://www.google.co.in/").then().statusCode(200);
希望对您有所帮助