Skip to content

Commit

Permalink
check body is writable only on ouput buffering append
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Nov 6, 2019
1 parent 00ef749 commit 6cc6184
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Slim/Middleware/OutputBufferingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
throw $e;
}

if (!empty($output) && $response->getBody()->isWritable()) {
if (!empty($output)) {
if ($this->style === static::PREPEND) {
$body = $this->streamFactory->createStream();
$body->write($output . $response->getBody());
$response = $response->withBody($body);
} elseif ($this->style === static::APPEND) {
} elseif ($this->style === static::APPEND && $response->getBody()->isWritable()) {
$response->getBody()->write($output);
}
}
Expand Down

0 comments on commit 6cc6184

Please sign in to comment.