diff --git a/src/RedirectClientDecorator.php b/src/RedirectClientDecorator.php index e512a1a..cf8e020 100644 --- a/src/RedirectClientDecorator.php +++ b/src/RedirectClientDecorator.php @@ -43,6 +43,9 @@ public function sendRequest(RequestInterface $request): ResponseInterface $userInfo = $url['user'] . $url['pass'] ? ':' . $url['pass'] : ''; if (array_key_exists('scheme', $url) && $url['scheme'] !== $uri->getScheme()) { $uri = $uri->withScheme($url['scheme']); + if (!array_key_exists('port', $url)) { + $url['port'] = $url['scheme'] === 'https' ? 443 : 80; + } } if ($uri->getUserInfo() !== $userInfo) { $uri = $uri->withUserInfo($userInfo);