Skip to content

Commit 425e6d2

Browse files
authored
Fix port in absolute Url (#36)
Add a missing colon before the port in the url. From `http://hostport` to `http://host:port`
1 parent 7af4600 commit 425e6d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/UrlBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($url)
4242
*/
4343
public function build($absolute = true)
4444
{
45-
$host = $absolute ? $this->get('scheme') . '://' . $this->get('host') . $this->get('port') : '';
45+
$host = $absolute ? $this->get('scheme') . '://' . $this->get('host') . (($port = $this->get('port')) ? ":{$port}": '') : '';
4646
$path = '/' . trim($this->get('path'), '/');
4747
$query = $this->get('query') ? '?' . $this->get('query') : '';
4848

0 commit comments

Comments
 (0)