How to validate if the status code returned is Successful i.e any of the 2xx HTTP status codes using Rest Assured?

Viewed 2349

I would like to assert if the status code returned is any of the 2xx series i.e 200 or 201 or 204. I don't want to do it the old fashioned way e.g.

if(response.statusCode() == 200 || response.statusCode() == 201 || 
   response.statusCode() == 204) {
     
     \\...
  }

Is there any better way to do?

1 Answers
Related