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

Commit 9f89ca2

Browse files
committed
Merge branch 'feature/161' into develop
Close #161 Fixes #160
2 parents a4eecc6 + 640e66e commit 9f89ca2

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file, in reverse
1010

1111
### Changed
1212

13+
- [#161](https://github.com/zendframework/zend-http/pull/161) changes how the Socket and Test adapters aggregate headers. Previously,
14+
they would `ucfirst()` the header name; now, they correctly leave the header
15+
names untouched, as header names should be considered case-insensitive.
16+
1317
- [#156](https://github.com/zendframework/zend-http/pull/156) changes how gzip and deflate decompression occur in responses, ensuring
1418
that if the Content-Length header reports 0, no decompression is attempted,
1519
and an empty string is returned.

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)