No need to use Zend\Diactoros\Stream

This commit is contained in:
Alex Bilbie 2016-03-17 11:21:53 +00:00
parent bd12c8b1a9
commit 15b6506644
2 changed files with 4 additions and 10 deletions

View File

@ -6,7 +6,6 @@ use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Server; use League\OAuth2\Server\Server;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Stream;
class AuthenticationServerMiddleware class AuthenticationServerMiddleware
{ {
@ -40,10 +39,8 @@ class AuthenticationServerMiddleware
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} catch (\Exception $exception) { } catch (\Exception $exception) {
$body = new Stream('php://temp', 'r+'); $response->getBody()->write($exception->getMessage());
$body->write($exception->getMessage()); return $response->withStatus(500);
return $response->withStatus(500)->withBody($body);
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }

View File

@ -6,7 +6,6 @@ use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Server; use League\OAuth2\Server\Server;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Stream;
class ResourceServerMiddleware class ResourceServerMiddleware
{ {
@ -40,10 +39,8 @@ class ResourceServerMiddleware
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} catch (\Exception $exception) { } catch (\Exception $exception) {
$body = new Stream('php://temp', 'r+'); $response->getBody()->write($exception->getMessage());
$body->write($exception->getMessage()); return $response->withStatus(500);
return $response->withStatus(500)->withBody($body);
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }