@Test
@TestDir
@TestJetty
@TestHdfs
public void testContentType() throws Exception {

  createHttpFSServer(false, false);
  FileSystem fs = FileSystem.get(TestHdfsHelper.getHdfsConf());
  Path dir = new Path("/tmp");
  Path file = new Path(dir, "foo");
  fs.mkdirs(dir);
  fs.create(file);
  String user = HadoopUsersConfTestHelper.getHadoopUsers()[0];
  URL url = new URL(TestJettyHelper.getJettyURL(), MessageFormat.format(
      "/webhdfs/v1/tmp/foo?user.name={0}&op=open&offset=1&length=2", user));
  // test jsonParse with non-json type.
  final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  conn.setRequestMethod(Operation.OPEN.getMethod());
  conn.connect();
  LambdaTestUtils.intercept(IOException.class,
      "Content-Type \"text/html;charset=iso-8859-1\" "
          + "is incompatible with \"application/json\"",
      () -> HttpFSUtils.jsonParse(conn));
  conn.disconnect();
}