private static String tryGetResponseTextFrom(HttpURLConnection conn, int status) throws IOException {
        String text;
        try (final BufferedReader rd = new BufferedReader(
                new InputStreamReader(status >= 400
                    ? conn.getErrorStream()
                    : conn.getInputStream()))) {

            final StringBuilder sb = new StringBuilder();
            String line;
            while ((line = rd.readLine()) != null) {
                sb.append(line);
            }

            text = sb.toString();
        }
        return text;
    }
Default implementation of the {@link Rest}-interface.

@author  Emil Forslund
@since   1.0.0
common-parent/rest/src/main/java/com/speedment/common/rest/RestImpl.java