diff --git a/Slim/Middleware/OutputBufferingMiddleware.php b/Slim/Middleware/OutputBufferingMiddleware.php index b93374085..71dfd057a 100644 --- a/Slim/Middleware/OutputBufferingMiddleware.php +++ b/Slim/Middleware/OutputBufferingMiddleware.php @@ -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); } }