Response Logging in REST Assured

In this one we are going to log the response. For request we log after given() for response we log after then(). You can log cookies, status, headers, body and all components at once. Check below example:

public class DummyRestAPIExample 
	public void setup()
		RestAssured.baseURI = "";
		RestAssured.basePath = "/api";
	public void postMethodExample()
			.body("{" + 
					"\"name\":\"Tarun Goswami\",\n" + 
					"\"job\":\"QA\",\n" + 
//			.cookies()
//			.headers()
//			.body()
//			.all()

Uncomment the component in above example which you want to log.

Wed, 09/02/2020 - 04:33
Tarun Goswami is a highly experienced professional, currently serving as Technical Lead at a well-established IT services company. With over 12 years of experience across multiple domains, he demonstrates his expertise and passion for the industry through his engaging and informative blog writing in his spare time.