Skip to content

Commit

Permalink
Merge pull request #1435 from codeguy/3.x-verify-body-streamable
Browse files Browse the repository at this point in the history
Do not assume response body is seekable in App::respond. Fixes #1434
  • Loading branch information
silentworks committed Aug 12, 2015
2 parents b671071 + ca438e7 commit 15aea44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Slim/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ public function respond(ResponseInterface $response)
// Body
if (!$this->isEmptyResponse($response)) {
$body = $response->getBody();
$body->rewind();
if ($body->isSeekable()) {
$body->rewind();
}
$settings = $this->container->get('settings');
while (!$body->eof()) {
echo $body->read($settings['responseChunkSize']);
Expand Down

0 comments on commit 15aea44

Please sign in to comment.