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

Commit

Permalink
remove upper casing first character on headers in socker class
Browse files Browse the repository at this point in the history
  • Loading branch information
DaDeather committed Nov 13, 2018
1 parent bdfe6ca commit e0620b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
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

0 comments on commit e0620b1

Please sign in to comment.