Skip to content

Commit d9ba8d2

Browse files
committed
Merge pull request #55 from php-http/bug/missing-transfer-header
Add missing transfer encoding header for chunked
2 parents 59a8aa1 + a9d6353 commit d9ba8d2

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 1.0.1 - 2016-01-29
4+
5+
### Changed
6+
7+
- Set the correct header for the Content-Length when in chunked mode.
38

49
## 1.0.0 - 2016-01-28
510

spec/ContentLengthPluginSpec.php

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function it_streams_chunked_if_no_size(RequestInterface $request, StreamInterfac
3737

3838
$stream->getSize()->shouldBeCalled()->willReturn(null);
3939
$request->withBody(Argument::type('Http\Message\Encoding\ChunkStream'))->shouldBeCalled()->willReturn($request);
40+
$request->withAddedHeader('Transfer-Encoding', 'chunked')->shouldBeCalled()->willReturn($request);
4041

4142
$this->handleRequest($request, function () {}, function () {});
4243
}

src/ContentLengthPlugin.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
2424
if (null === $stream->getSize()) {
2525
$stream = new ChunkStream($stream);
2626
$request = $request->withBody($stream);
27+
$request = $request->withAddedHeader('Transfer-Encoding', 'chunked');
2728
} else {
2829
$request = $request->withHeader('Content-Length', $stream->getSize());
2930
}

0 commit comments

Comments
 (0)