Skip to content

Commit

Permalink
Merge pull request #2878 from juliangut/output-buffering-body-check
Browse files Browse the repository at this point in the history
check body is writable only on ouput buffering append
  • Loading branch information
l0gicgate committed Nov 6, 2019
2 parents 00ef749 + 6cc6184 commit 3617c6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Slim/Middleware/OutputBufferingMiddleware.php
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 3617c6c

Please sign in to comment.