title: CakePhp is returning HTML and BODY tags along with the json?
body: <p>I am trying to return plain old JSON but for some reason it is being returned like this:</p>
  
  <pre><code>&lt;html&gt;
     &lt;body&gt;
         {
            "token":"MTEyLSQyeSQxMCRHVS9nS2t2QVRVcGpJWjJGVERldXouWWJFTzgyZ0lCTURBZFIvdWs2RldGNm1IeWxxNGpTUw==",
            "user":{
                "id":112,
                "username":"admin",
                "firstName":"admin",
                "lastName":"admin",
             },
             "userType":{
                "id":1,
                "name":"admin"
             }
         }
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am currently using CakePHP to send the response:</p>
  
  <pre><code>/**
   * @param $controller \App\Controller\AppController
   */
  public function respond($controller) {
      $controller-&gt;response-&gt;header('Content-Type: application/json');
      $controller-&gt;response-&gt;statusCode($this-&gt;statusCode);
      $controller-&gt;response-&gt;body(json_encode($this-&gt;messages));
  }
  </code></pre>
  
  <p>But I have also tried using plain PHP:</p>
  
  <pre><code>echo json_encode($this-&gt;messages);
  die();
  </code></pre>
  
  <p>The HTML tags are not problems for my front end, they seem to be ignored by javascript. But some reason TestNG is getting the HTML tags and making the response non-parseable.</p>
  
  <p>Any ideas? </p>