Testing AJAX/XMLHttpRequest pages functionally in Symfony2

前端 未结 4 1232
迷失自我
迷失自我 2021-02-04 04:54

Is it possible to simulate/make an XMLHttpRequest request (ajax) in symfony2 tests?

4条回答
  •  迷失自我
    2021-02-04 05:09

    After search with "Problematic" answer, the correct syntax is:

    $crawler = $client->request('GET', '/foo/', array(), array(), array(
        'HTTP_X-Requested-With' => 'XMLHttpRequest',
    ));
    

提交回复
热议问题