Which method is used to send a GET request in RestAssured?
A) get()
B) post()
C) put()
D) delete()
Answer:
A) get()
Explanation:
The get()
method in RestAssured is used to send an HTTP GET request. This method is used when you want to retrieve data from a specified resource.
For example:
import static io.restassured.RestAssured.*;
given().
when().
get("/api/resource").
then().
statusCode(200);
In this example, the get()
method sends a GET request to the specified API endpoint and checks that the response status code is 200.