Skip to content

Commit aaaafa9

Browse files
committed
Merge pull request #1946 from tPl0ch/hotfix/client-custom-http-headers
Added example of non standard 'X-Requested-With' HTTP header.
2 parents f586d79 + 7a1c694 commit aaaafa9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

book/testing.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,19 @@ document::
235235
)
236236

237237
The ``server`` array is the raw values that you'd expect to normally
238-
find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`
239-
and `Referer` HTTP headers, you'd pass the following::
238+
find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`,
239+
`Referer` and `X-Requested-With' HTTP headers, you'd pass the following (mind
240+
the `HTTP_` prefix for non standard headers)::
240241

241242
$client->request(
242243
'GET',
243244
'/demo/hello/Fabien',
244245
array(),
245246
array(),
246247
array(
247-
'CONTENT_TYPE' => 'application/json',
248-
'HTTP_REFERER' => '/foo/bar',
248+
'CONTENT_TYPE' => 'application/json',
249+
'HTTP_REFERER' => '/foo/bar',
250+
'HTTP_X-Requested-With' => 'XMLHttpRequest',
249251
)
250252
);
251253

0 commit comments

Comments
 (0)