public static String readBody(final HttpURLConnection connection) throws IOException {
        try (var isr = new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8);
             var br = new BufferedReader(isr)) {
            val sb = new StringBuilder();
            String output;
            while ((output = br.readLine()) != null) {
                sb.append(output);
            }
            return sb.toString();
        }
    }
<p>readBody.</p>

@param connection a {@link HttpURLConnection} object
@return a {@link String} object
@throws IOException if any.
pac4j-core/src/main/java/org/pac4j/core/util/HttpUtils.java