From 15b6506644b1c050563e3a02e1030f1298aff207 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 17 Mar 2016 11:21:53 +0000 Subject: [PATCH] No need to use Zend\Diactoros\Stream --- src/Middleware/AuthenticationServerMiddleware.php | 7 ++----- src/Middleware/ResourceServerMiddleware.php | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Middleware/AuthenticationServerMiddleware.php b/src/Middleware/AuthenticationServerMiddleware.php index 4038d95e..2be5ca63 100644 --- a/src/Middleware/AuthenticationServerMiddleware.php +++ b/src/Middleware/AuthenticationServerMiddleware.php @@ -6,7 +6,6 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Server; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Zend\Diactoros\Stream; class AuthenticationServerMiddleware { @@ -40,10 +39,8 @@ class AuthenticationServerMiddleware return $exception->generateHttpResponse($response); // @codeCoverageIgnoreStart } catch (\Exception $exception) { - $body = new Stream('php://temp', 'r+'); - $body->write($exception->getMessage()); - - return $response->withStatus(500)->withBody($body); + $response->getBody()->write($exception->getMessage()); + return $response->withStatus(500); // @codeCoverageIgnoreEnd } diff --git a/src/Middleware/ResourceServerMiddleware.php b/src/Middleware/ResourceServerMiddleware.php index eecaabbe..e30ded8a 100644 --- a/src/Middleware/ResourceServerMiddleware.php +++ b/src/Middleware/ResourceServerMiddleware.php @@ -6,7 +6,6 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Server; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use Zend\Diactoros\Stream; class ResourceServerMiddleware { @@ -40,10 +39,8 @@ class ResourceServerMiddleware return $exception->generateHttpResponse($response); // @codeCoverageIgnoreStart } catch (\Exception $exception) { - $body = new Stream('php://temp', 'r+'); - $body->write($exception->getMessage()); - - return $response->withStatus(500)->withBody($body); + $response->getBody()->write($exception->getMessage()); + return $response->withStatus(500); // @codeCoverageIgnoreEnd }