diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-05-24 22:52:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 22:52:10 +0300 |
commit | 85e5cfb2fc5dabec712954566bdb63d8f1e30671 (patch) | |
tree | 22db598e5f11094fb8a7b1086b3987fd52974a67 /tests/PHPUnit | |
parent | f7569268f2a7fecd4fd1a95c430d3a1005471e08 (diff) |
Allow setting custom headers for requests done by Http::sendHttpRequestBy (#11738)
Diffstat (limited to 'tests/PHPUnit')
-rw-r--r-- | tests/PHPUnit/Integration/Http/AdditionalHeaders.php | 7 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/HttpTest.php | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/Http/AdditionalHeaders.php b/tests/PHPUnit/Integration/Http/AdditionalHeaders.php new file mode 100644 index 0000000000..88dd746048 --- /dev/null +++ b/tests/PHPUnit/Integration/Http/AdditionalHeaders.php @@ -0,0 +1,7 @@ +<?php + +// used in integration tests to see if additional header works. + +echo $_SERVER['HTTP_CUSTOMHEADER']; + +exit; diff --git a/tests/PHPUnit/Integration/HttpTest.php b/tests/PHPUnit/Integration/HttpTest.php index 1fdec7b6ed..371ad82459 100644 --- a/tests/PHPUnit/Integration/HttpTest.php +++ b/tests/PHPUnit/Integration/HttpTest.php @@ -229,6 +229,33 @@ class HttpTest extends \PHPUnit_Framework_TestCase /** * @dataProvider getMethodsToTest */ + public function testHttpCustomHeaders($method) + { + $result = Http::sendHttpRequestBy( + $method, + Fixture::getRootUrl() . 'tests/PHPUnit/Integration/Http/AdditionalHeaders.php', + 30, + $userAgent = null, + $destinationPath = null, + $file = null, + $followDepth = 0, + $acceptLanguage = false, + $acceptInvalidSslCertificate = false, + $byteRange = false, + $getExtendedInfo = false, + $httpMethod = 'POST', + $httpUsername = '', + $httpPassword = '', + array(), + array('CustomHeader: customdata') + ); + + $this->assertEquals('customdata', $result); + } + + /** + * @dataProvider getMethodsToTest + */ public function testHttpsWorksWithValidCertificate($method) { $result = Http::sendHttpRequestBy($method, 'https://builds.piwik.org/LATEST', 10); |