diff --git a/Uri/Http.php b/Uri/Http.php index cdf678c98..18d6c88df 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -266,7 +266,8 @@ class Http implements UriInterface */ public function getRoute() : string { - return ($this->path ?? '') . '?' . $this->getQuery(); + $query = $this->getQuery(); + return ($this->path ?? '') . (!empty($query) ? '?' . $this->getQuery() : ''); } /**