From the course: Java: Automated API Testing with REST Assured

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Verifying response header

Verifying response header - Java Tutorial

From the course: Java: Automated API Testing with REST Assured

Start my 1-month free trial

Verifying response header

- [Instructor] As a reminder, a response is not limited to the body. It also contains headers. Let's print the headers of our response to see what it contains. To do so, we'll modify this get products, test a little bit, and we'll change the log from body to headers. And let's print this out just to see what's there in the headers. In the output, we see the headers. In each line here is a single header. We see there are many headers returned, such as the server that this is run against, the date of the response, the content type and so on. Now, while all of this information is provided, it's not always necessary to verify all of it. This again is one of the times where you need to make a judgment call. The one header here that seems pretty important to verify is the content type that's returned. For example, if your API supports both XML and JSON formats, you want to make sure that the response is in the correct…

Contents