Skip to main content

REST Assured API | Why we use equalTo() while asserting body part of response?

When we assert our body part, we use the method equalTo() but while asserting for Header, we are just providing ("Key","value") pair only. Why can't we use just- body("scope","APP") Any specific reason behind this?

Below is the actual code.

assertThat().statusCode(200).body("scope",equalTo("APP")).header("Server","Apache/2.4.18 (Ubuntu)");