Include baseURL with relative setGetVar() links (#8834)

* Return baseURL with setGetVar

* Adjust testSetGetVar tests for base url
This commit is contained in:
Ralph Slooten 2019-04-15 14:50:46 +12:00 committed by Aaron Carlino
parent 2c971eea83
commit 66c372ce28
2 changed files with 3 additions and 3 deletions

View File

@ -268,7 +268,7 @@ class HTTP
$newUri = $scheme . '://' . $user . $host . $port . $path . $params . $fragment; $newUri = $scheme . '://' . $user . $host . $port . $path . $params . $fragment;
if ($isRelative) { if ($isRelative) {
return Director::makeRelative($newUri); return Director::baseURL() . Director::makeRelative($newUri);
} }
return $newUri; return $newUri;

View File

@ -246,13 +246,13 @@ class HTTPTest extends FunctionalTest
}, 'relative/url/'); }, 'relative/url/');
$this->assertEquals( $this->assertEquals(
'relative/url?foo=bar', '/relative/url?foo=bar',
HTTP::setGetVar('foo', 'bar', 'relative/url'), HTTP::setGetVar('foo', 'bar', 'relative/url'),
'Relative URL without existing query params' 'Relative URL without existing query params'
); );
$this->assertEquals( $this->assertEquals(
'relative/url?baz=buz&foo=bar', '/relative/url?baz=buz&foo=bar',
HTTP::setGetVar('foo', 'bar', '/relative/url?baz=buz'), HTTP::setGetVar('foo', 'bar', '/relative/url?baz=buz'),
'Relative URL with existing query params, and new added key' 'Relative URL with existing query params, and new added key'
); );