Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
- Fixed host not set on request url.
- Url returns relativeUrl when calling toString() to avoid any issues when using in RouteUrl(url()) for rewrites.
  • Loading branch information
skipperbent committed Nov 6, 2024
1 parent 0634ba7 commit 90418eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Pecee/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ public function setUrl(Url $url): void
{
$this->url = $url;

if ($this->getHost() !== null) {
$url->setHost($this->getHost());
}

if ($this->isSecure() === true) {
$this->url->setScheme('https');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Pecee/Http/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public function jsonSerialize(): string

public function __toString(): string
{
return $this->getHost(true) . $this->getRelativeUrl();
return $this->getRelativeUrl();
}

}

0 comments on commit 90418eb

Please sign in to comment.