From 4f304013f95f022fb3af139fee07064cf82168ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mleczko?= Date: Mon, 20 May 2019 12:17:57 +0200 Subject: [PATCH] Fix populating default port and headers in HttpFoundationFactory --- Factory/HttpFoundationFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Factory/HttpFoundationFactory.php b/Factory/HttpFoundationFactory.php index 68ba7dd..105dd99 100644 --- a/Factory/HttpFoundationFactory.php +++ b/Factory/HttpFoundationFactory.php @@ -49,7 +49,7 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed if ($uri instanceof UriInterface) { $server['SERVER_NAME'] = $uri->getHost(); - $server['SERVER_PORT'] = $uri->getPort(); + $server['SERVER_PORT'] = $uri->getPort() ?: ('https' === $uri->getScheme() ? 443 : 80); $server['REQUEST_URI'] = $uri->getPath(); $server['QUERY_STRING'] = $uri->getQuery(); @@ -74,7 +74,7 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed $server, $streamed ? $psrRequest->getBody()->detach() : $psrRequest->getBody()->__toString() ); - $request->headers->replace($psrRequest->getHeaders()); + $request->headers->add($psrRequest->getHeaders()); return $request; }