checkIsSuccessStatusCode static method

Response checkIsSuccessStatusCode(
  1. Response response
)

Checks that the response has a success status code.

Throws a ClientException if the response does not have a success status code.

Implementation

static Response checkIsSuccessStatusCode(Response response) {
  if (!response.isSuccessStatusCode) {
    throw ClientException.fromResponse(response);
  } else {
    return response;
  }
}