From 96c180b315d1c4c3c825f2f2b811d81d28dc9b39 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 15 Oct 2017 11:33:28 +0200 Subject: [PATCH] Use Psr7 consistently --- src/RequestHeaderParser.php | 4 ++-- src/Server.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/RequestHeaderParser.php b/src/RequestHeaderParser.php index a6126da9..81096cdc 100644 --- a/src/RequestHeaderParser.php +++ b/src/RequestHeaderParser.php @@ -4,7 +4,7 @@ use Evenement\EventEmitter; use Exception; -use RingCentral\Psr7 as g7; +use RingCentral\Psr7; /** * @event headers @@ -92,7 +92,7 @@ private function parseRequest($headers) } // parse request headers into obj implementing RequestInterface - $request = g7\parse_request($headers); + $request = Psr7\parse_request($headers); // create new obj implementing ServerRequestInterface by preserving all // previous properties and restoring original request-target diff --git a/src/Server.php b/src/Server.php index 59ff6880..ff5b3fb9 100644 --- a/src/Server.php +++ b/src/Server.php @@ -8,7 +8,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use React\Promise\Promise; -use RingCentral\Psr7 as Psr7Implementation; +use RingCentral\Psr7; use Psr\Http\Message\ServerRequestInterface; use React\Promise\CancellablePromiseInterface; use React\Stream\WritableStreamInterface; @@ -353,7 +353,7 @@ public function handleResponse(ConnectionInterface $connection, ServerRequestInt // response to HEAD and 1xx, 204 and 304 responses MUST NOT include a body // exclude status 101 (Switching Protocols) here for Upgrade request handling below if ($request->getMethod() === 'HEAD' || $code === 100 || ($code > 101 && $code < 200) || $code === 204 || $code === 304) { - $response = $response->withBody(Psr7Implementation\stream_for('')); + $response = $response->withBody(Psr7\stream_for('')); } // 101 (Switching Protocols) response uses Connection: upgrade header @@ -388,7 +388,7 @@ public function handleResponse(ConnectionInterface $connection, ServerRequestInt private function handleResponseBody(ResponseInterface $response, ConnectionInterface $connection) { if (!$response->getBody() instanceof HttpBodyStream) { - $connection->write(Psr7Implementation\str($response)); + $connection->write(Psr7\str($response)); return $connection->end(); } @@ -399,7 +399,7 @@ private function handleResponseBody(ResponseInterface $response, ConnectionInter return $stream->close(); } - $connection->write(Psr7Implementation\str($response)); + $connection->write(Psr7\str($response)); if ($stream->isReadable()) { if ($response->getHeaderLine('Transfer-Encoding') === 'chunked') {