I am getting different results from postman and Rest assured , using same endpoints and request

1.4k Views Asked by At

While from postman, its always successful and returning json object , but from rest assured , its returning html page. Is there something I can do about it? I am using testNG and theses static imports apis: io.restassured.RestAssured.* io.restassured.matcher.RestAssuredMatchers.* org.hamcrest.Matchers.*

1

There are 1 best solutions below

0
On

Make sure RestAssured is adding an appropriate Accept header, like this:

Accept: application/json

This is part of content negotiation.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation

has a good overview.