Skip to content

Commit

Permalink
Merge pull request #56 from lunika/content_length_fix
Browse files Browse the repository at this point in the history
cast StreamInterface::getSize return in string into ContentLengthPlugin
  • Loading branch information
dbu authored Jan 20, 2017
2 parents 3cf7eb9 + fcbb02e commit a624fcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/Plugin/ContentLengthPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function it_adds_content_length_header(RequestInterface $request, StreamInterfac
$request->hasHeader('Content-Length')->shouldBeCalled()->willReturn(false);
$request->getBody()->shouldBeCalled()->willReturn($stream);
$stream->getSize()->shouldBeCalled()->willReturn(100);
$request->withHeader('Content-Length', 100)->shouldBeCalled()->willReturn($request);
$request->withHeader('Content-Length', '100')->shouldBeCalled()->willReturn($request);

$this->handleRequest($request, function () {}, function () {});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ContentLengthPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
$request = $request->withBody($stream);
$request = $request->withAddedHeader('Transfer-Encoding', 'chunked');
} else {
$request = $request->withHeader('Content-Length', $stream->getSize());
$request = $request->withHeader('Content-Length', (string) $stream->getSize());
}
}

Expand Down

0 comments on commit a624fcb

Please sign in to comment.