Is it possible to extract the method name from the

2019-07-10 15:07发布

问题:

I'm using REST-Assured in Java and here's how I'm getting my response object:

Response response = RestAssured.given().contentType(ContentType.JSON).header(header_name).get();

I want to know if there's any way to extract the method name used (GET in this case) from the response object.

回答1:

Incase if you're interested in knowing the requested method say GET or POST, below code will print the method on the console

given().log().method()
        .when()
        .get("https://www.google.co.in/").then().statusCode(200);

Hope this helps