public static FeignException errorStatus(
      String methodKey, Response response, Integer maxBodyBytesLength, Integer maxBodyCharsLength) {

    byte[] body = {};
    try {
      if (response.body() != null) {
        body = Util.toByteArray(response.body().asInputStream());
      }
    } catch (IOException ignored) { // NOPMD
    }

    String message =
        new FeignExceptionMessageBuilder()
            .withResponse(response)
            .withMethodKey(methodKey)
            .withMaxBodyBytesLength(maxBodyBytesLength)
            .withMaxBodyCharsLength(maxBodyCharsLength)
            .withBody(body)
            .build();

    return errorStatus(response.status(), message, response.request(), body, response.headers());
  }
The Response body.

@return an Optional wrapping the response body.
core/src/main/java/feign/FeignException.java