hasStatus method

bool hasStatus(
  1. int expectedStatusCode
)

Check if response has a specific status code.

Convenience method for status code assertions in tests.

Example:

expect(response.hasStatus(200), true);
expect(response.hasStatus(404), false);

expectedStatusCode The status code to check for. Returns true if status codes match, false otherwise.

Implementation

bool hasStatus(int expectedStatusCode) {
  return statusCode == expectedStatusCode;
}