Skip to content

Commit 15b371d

Browse files
committed
Add missing transfer encoding header for chunked
1 parent 59a8aa1 commit 15b371d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

spec/ContentLengthPluginSpec.php

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)