Skip to content

Commit

Permalink
Url::getHostUrl() doesn't return empty // [Closes #96]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 26, 2016
1 parent f72d71d commit 59c955d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Http/Url.php
Expand Up @@ -376,7 +376,8 @@ public function getAuthority()
*/
public function getHostUrl()
{
return ($this->scheme ? $this->scheme . ':' : '') . '//' . $this->getAuthority();
return ($this->scheme ? $this->scheme . ':' : '')
. (($authority = $this->getAuthority()) || $this->scheme ? '//' . $authority : '');
}


Expand Down
2 changes: 1 addition & 1 deletion tests/Http/Url.httpScheme.phpt
Expand Up @@ -49,7 +49,7 @@ $url->setPath('');
Assert::same('/', $url->getPath());

$url->setHost('')->setPath('');
Assert::same('//?arg=value#anchor', $url->absoluteUrl);
Assert::same('?arg=value#anchor', $url->absoluteUrl);

$url->setPath('');
Assert::same('', $url->getPath());

0 comments on commit 59c955d

Please sign in to comment.