code: private static String getResponseMimeType(final HttpResponse httpHeadResponse) {
          Header contentTypeHeader = httpHeadResponse.getFirstHeader("Content-Type");
          if (contentTypeHeader != null) {
              String contentType = contentTypeHeader.getValue();
              if (contentType != null) {
                  try {
                      return ContentType.parse(contentType).getMimeType();
                  } catch (ParseException | UnsupportedCharsetException exception) {
                      return contentType.split(";")[0].trim();
                  }
              }
          }
  
          return ContentType.DEFAULT_TEXT.getMimeType();
      }
docs: Returns the MIME type of the HTTP HEAD response. If the Content-Type header is not present in
  the response it returns "text/plain".
  
  @param httpHeadResponse the HTTP HEAD response
  
  @return the MIME type of the response