From 8763e6142f2524f40f40a69f7b0e4a19fc69a218 Mon Sep 17 00:00:00 2001 From: Thomas Ploch Date: Wed, 21 Nov 2012 16:28:25 +0100 Subject: [PATCH 1/2] Added example of non standard 'X-Requested-With' HTTP header. This example is giving an example on how to add a non standard header, and as well reminding the user to add a 'HTTP_' prefix, so the custom header gets sent. --- book/testing.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/book/testing.rst b/book/testing.rst index 6972af66b80..ea658d57e5f 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -235,8 +235,9 @@ document:: ) The ``server`` array is the raw values that you'd expect to normally - find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type` - and `Referer` HTTP headers, you'd pass the following:: + find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`, + `Referer` and `X-Requested-With' HTTP headers, you'd pass the following (mind + the `HTTP_` prefix for non standard headers):: $client->request( 'GET', @@ -244,8 +245,9 @@ document:: array(), array(), array( - 'CONTENT_TYPE' => 'application/json', - 'HTTP_REFERER' => '/foo/bar', + 'CONTENT_TYPE' => 'application/json', + 'HTTP_REFERER' => '/foo/bar', + 'HTTP_X-Requested-With' => 'XMLHttpRequest' ) ); From 7a1c6942d957aef4f8a8c25c80deac73fb57704e Mon Sep 17 00:00:00 2001 From: Thomas Ploch Date: Wed, 21 Nov 2012 17:57:51 +0100 Subject: [PATCH 2/2] Added missing ',' to example code array. --- book/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/testing.rst b/book/testing.rst index ea658d57e5f..51a2e8a08f6 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -247,7 +247,7 @@ document:: array( 'CONTENT_TYPE' => 'application/json', 'HTTP_REFERER' => '/foo/bar', - 'HTTP_X-Requested-With' => 'XMLHttpRequest' + 'HTTP_X-Requested-With' => 'XMLHttpRequest', ) );