@@ -359,8 +359,8 @@ returns a ``Crawler`` instance.
359359 )
360360
361361 The ``server `` array is the raw values that you'd expect to normally
362- find in the PHP `$_SERVER `_ superglobal. For example, to set the `` Content-Type ``,
363- ``Referer `` and ``X-Requested-With `` HTTP headers, you'd pass the following (mind
362+ find in the PHP `$_SERVER `_ superglobal. For example, to set the
363+ ``Content-Type `` and ``Referer `` HTTP headers, you'd pass the following (mind
364364 the ``HTTP_ `` prefix for non standard headers)::
365365
366366 $client->request(
@@ -369,9 +369,8 @@ returns a ``Crawler`` instance.
369369 array(),
370370 array(),
371371 array(
372- 'CONTENT_TYPE' => 'application/json',
373- 'HTTP_REFERER' => '/foo/bar',
374- 'HTTP_X-Requested-With' => 'XMLHttpRequest',
372+ 'CONTENT_TYPE' => 'application/json',
373+ 'HTTP_REFERER' => '/foo/bar',
375374 )
376375 );
377376
@@ -441,6 +440,19 @@ script::
441440
442441 $client->insulate();
443442
443+ AJAX Requests
444+ ~~~~~~~~~~~~~
445+
446+ The Client provides a :method: `Symfony\\ Component\\ BrowserKit\\ Client::xmlHttpRequest `
447+ method, which has the same arguments as the ``request() `` method, and it's a
448+ shortcut to make AJAX requests::
449+
450+ // the required HTTP_X_REQUESTED_WITH header is added automatically
451+ $client->xmlHttpRequest('POST', '/submit', array('name' => 'Fabien'));
452+
453+ .. versionadded :: 4.1
454+ The ``xmlHttpRequest() `` method was introduced in Symfony 4.1.
455+
444456Browsing
445457~~~~~~~~
446458
0 commit comments