title: Codeception, unable to simulate ajax behavior
body: <p>I can't replicate ajax calls via codeception.</p>
  
  <p>For example:</p>
  
  <pre><code>$I-&gt;sendAjaxPostRequest('login/verify', array('name' =&gt; 'name', 'password' =&gt; 'password'));
  $I-&gt;seeResponseIsJson();
  </code></pre>
  
  <p>Will not raise any errors. But in the other hand, if I do the following:</p>
  
  <pre><code>$I-&gt;sendAjaxPostRequest('login/verify', array('name' =&gt; 'name', 'password' =&gt; 'password'));
  $I-&gt;seeResponseIsJson();
  $I-&gt;seeResponseContainsJson(['login_failed' =&gt; 1]);
  //or
  $I-&gt;grabDataFromJsonResponse('data.login_failed');
  </code></pre>
  
  <p>It gives me this error:</p>
  
  <blockquote>
    <p>ErrorException: Argument 2 passed to
    Codeception\Module\REST::arrayHasArray() must be of the type array,
    null given, called in
    C:\xampp\htdocs\blog\laravel\vendor\codeception\codeception\src\Codeception\Module\REST.php
    on line 485 and defined</p>
  </blockquote>
  
  <p>What I understand from the error above is that seeResponseContainsJson or grabDataFromJsonResponse internally will pass a response as a second argument to arrayHasArray. But it looks like no matter what the response is always empty.</p>
  
  <p>Also, if I do the following:</p>
  
  <pre><code>$I-&gt;sendAjaxPostRequest('login/verify', array('name' =&gt; 'name', 'password' =&gt; 'password'));
  var_dump($I-&gt;grabResponse());
  </code></pre>
  
  <p>I receive this for var_dump():</p>
  
  <pre><code>object(Codeception\Maybe)#753 (3) {
    ["position":protected]=&gt;
    int(0)
    ["val":protected]=&gt;
    NULL
    ["assocArray":protected]=&gt;
    NULL
  }
  </code></pre>
  
  <p>Everything else works as expected with Codeception, I'm using PhpBrowser.</p>