public static String getResponseContentAsString(@NotNull HttpMethod response) throws IOException {
    // Sometimes servers don't specify encoding and HttpMethod#getResponseBodyAsString
    // by default decodes from Latin-1, so we got to read byte stream and decode it from UTF-8
    // manually
    //if (!response.hasBeenUsed()) {
    //  return "";
    //}
    org.apache.commons.httpclient.Header header = response.getResponseHeader(HTTP.CONTENT_TYPE);
    if (header != null && header.getValue().contains("charset")) {
      // ISO-8859-1 if charset wasn't specified in response
      return StringUtil.notNullize(response.getResponseBodyAsString());
    }
    else {
      InputStream stream = response.getResponseBodyAsStream();
      if (stream == null) return "";
      try (Reader reader = new InputStreamReader(stream, DEFAULT_CHARSET)) {
        return StreamUtil.readText(reader);
      }
    }
  }
public static String getResponseContentAsString(@NotNull HttpMethod response)