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

Commit 993cf91

Browse files
committed
Merge pull request #161 from DaDeather/master
Do not upper case first character of headers in socket adapter
2 parents a4eecc6 + e0620b1 commit 993cf91

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/Client/Adapter/Socket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
389389
$request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n";
390390
foreach ($headers as $k => $v) {
391391
if (is_string($k)) {
392-
$v = ucfirst($k) . ': ' . $v;
392+
$v = $k . ': ' . $v;
393393
}
394394
$request .= $v . "\r\n";
395395
}

src/Client/Adapter/Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function write($method, $uri, $httpVer = '1.1', $headers = [], $body = ''
132132
$request = $method . ' ' . $path . ' HTTP/' . $httpVer . "\r\n";
133133
foreach ($headers as $k => $v) {
134134
if (is_string($k)) {
135-
$v = ucfirst($k) . ': ' . $v;
135+
$v = $k . ': ' . $v;
136136
}
137137
$request .= $v . "\r\n";
138138
}

test/Client/SocketTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,24 @@ public function testAllowsZeroWrittenBytes()
339339
$this->_adapter->write('GET', new Uri('tcp://localhost:80/'), '1.1', [], 'test body');
340340
}
341341

342+
/**
343+
* Verifies that the headers are being set as given without changing any
344+
* character case.
345+
*/
346+
public function testCaseInsensitiveHeaders()
347+
{
348+
$this->_adapter->connect('localhost');
349+
$requestString = $this->_adapter->write(
350+
'GET',
351+
new Uri('tcp://localhost:80/'),
352+
'1.1',
353+
['x-test-header' => 'someTestHeader'],
354+
'someTestBody'
355+
);
356+
357+
$this->assertContains('x-test-header', $requestString);
358+
}
359+
342360
/**
343361
* Data Providers
344362
*/

0 commit comments

Comments
 (0)