Which method is used to send a DELETE request in RestAssured?

Which method is used to send a DELETE request in RestAssured?

A) delete()
B) get()
C) post()
D) put()

Answer:

A) delete()

Explanation:

The delete() method in RestAssured is used to send an HTTP DELETE request. This method is used when you want to delete a specified resource.

For example:


import static io.restassured.RestAssured.*;

given().
    when().
    delete("/api/resource/1").
    then().
    statusCode(204);

In this example, the delete() method sends a DELETE request to the specified API endpoint and checks that the response status code is 204 (No Content).

Reference links:

https://www.javaguides.net/p/top-java-libraries.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top