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 27, 2016
1 parent 9f0203b commit 151c2f5
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 151c2f5

Please sign in to comment.