Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Do not upper case first character of headers in socket adapter #161

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Client/Adapter/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,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";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
18 changes: 18 additions & 0 deletions test/Client/SocketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,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
*/
Expand Down