<?php header("Content-Type: application/json; charset=utf-8"); ?>
<?php echo json_encode($json); ?>

<?php
if(!headers_sent()) {
  header("Content-Type: application/json; charset=utf-8");
}
?>
<?php echo json_encode($json); ?>

Improve test support: avoid send header when header sent.
Improve test support: avoid send header when header sent.
