diff --git a/src/Client/Adapter/Socket.php b/src/Client/Adapter/Socket.php index 26a17217a8..bd235583ff 100644 --- a/src/Client/Adapter/Socket.php +++ b/src/Client/Adapter/Socket.php @@ -389,7 +389,7 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = '' $request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n"; foreach ($headers as $k => $v) { if (is_string($k)) { - $v = ucfirst($k) . ': ' . $v; + $v = $k . ': ' . $v; } $request .= $v . "\r\n"; } diff --git a/src/Client/Adapter/Test.php b/src/Client/Adapter/Test.php index 92a2a48d4b..d65bba191e 100644 --- a/src/Client/Adapter/Test.php +++ b/src/Client/Adapter/Test.php @@ -132,7 +132,7 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = '' $request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n"; foreach ($headers as $k => $v) { if (is_string($k)) { - $v = ucfirst($k) . ': ' . $v; + $v = $k . ': ' . $v; } $request .= $v . "\r\n"; } diff --git a/test/Client/SocketTest.php b/test/Client/SocketTest.php index e1504041c8..94cac21038 100644 --- a/test/Client/SocketTest.php +++ b/test/Client/SocketTest.php @@ -339,6 +339,24 @@ public function testAllowsZeroWrittenBytes() $this->_adapter->write('GET', new Uri('tcp://localhost:80/'), '1.1', [], 'test body'); } + /** + * Verifies that the headers are being set as given without changing any + * character case. + */ + public function testCaseInsensitiveHeaders() + { + $this->_adapter->connect('localhost'); + $requestString = $this->_adapter->write( + 'GET', + new Uri('tcp://localhost:80/'), + '1.1', + ['x-test-header' => 'someTestHeader'], + 'someTestBody' + ); + + $this->assertContains('x-test-header', $requestString); + } + /** * Data Providers */