diff --git a/system/Config/Services.php b/system/Config/Services.php
index c0d5fcc392d2..61026de4292c 100644
--- a/system/Config/Services.php
+++ b/system/Config/Services.php
@@ -211,7 +211,7 @@ public static function curlrequest(array $options = [], ?ResponseInterface $resp
return new CURLRequest(
$config,
- new URI($options['base_uri'] ?? null),
+ new URI($options['baseURI'] ?? null),
$response,
$options
);
diff --git a/system/HTTP/ContentSecurityPolicy.php b/system/HTTP/ContentSecurityPolicy.php
index d0dda0ad5752..a6a2b26a71fc 100644
--- a/system/HTTP/ContentSecurityPolicy.php
+++ b/system/HTTP/ContentSecurityPolicy.php
@@ -356,9 +356,9 @@ public function reportOnly(bool $value = true)
}
/**
- * Adds a new base_uri value. Can be either a URI class or a simple string.
+ * Adds a new baseURI value. Can be either a URI class or a simple string.
*
- * base_uri restricts the URLs that can appear in a page's element.
+ * baseURI restricts the URLs that can appear in a page's element.
*
* @see http://www.w3.org/TR/CSP/#directive-base-uri
*
diff --git a/tests/system/HTTP/CURLRequestShareOptionsTest.php b/tests/system/HTTP/CURLRequestShareOptionsTest.php
index 38612ad03e05..8f6277cf9501 100644
--- a/tests/system/HTTP/CURLRequestShareOptionsTest.php
+++ b/tests/system/HTTP/CURLRequestShareOptionsTest.php
@@ -30,7 +30,7 @@ final class CURLRequestShareOptionsTest extends CURLRequestTest
{
protected function getRequest(array $options = []): MockCURLRequest
{
- $uri = isset($options['base_uri']) ? new URI($options['base_uri']) : new URI();
+ $uri = isset($options['baseURI']) ? new URI($options['baseURI']) : new URI();
$app = new App();
$config = new ConfigCURLRequest();
@@ -43,7 +43,7 @@ protected function getRequest(array $options = []): MockCURLRequest
public function testHeaderContentLengthNotSharedBetweenRequests(): void
{
$options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
+ 'baseURI' => 'http://www.foo.com/api/v1/',
];
$request = $this->getRequest($options);
@@ -61,8 +61,8 @@ public function testHeaderContentLengthNotSharedBetweenRequests(): void
public function testBodyIsResetOnSecondRequest(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setBody('name=George');
$request->setOutput('Hi there');
diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php
index df44c427a665..7c2d7b17138a 100644
--- a/tests/system/HTTP/CURLRequestTest.php
+++ b/tests/system/HTTP/CURLRequestTest.php
@@ -47,7 +47,7 @@ protected function setUp(): void
*/
protected function getRequest(array $options = []): MockCURLRequest
{
- $uri = isset($options['base_uri']) ? new URI($options['base_uri']) : new URI();
+ $uri = isset($options['baseURI']) ? new URI($options['baseURI']) : new URI();
$app = new App();
$config = new ConfigCURLRequest();
@@ -64,7 +64,7 @@ public function testPrepareURLIgnoresAppConfig(): void
{
config('App')->baseURL = 'http://example.com/fruit/';
- $request = $this->getRequest(['base_uri' => 'http://example.com/v1/']);
+ $request = $this->getRequest(['baseURI' => 'http://example.com/v1/']);
$method = $this->getPrivateMethodInvoker($request, 'prepareURL');
@@ -76,7 +76,7 @@ public function testPrepareURLIgnoresAppConfig(): void
*/
public function testGetRemembersBaseURI(): void
{
- $request = $this->getRequest(['base_uri' => 'http://www.foo.com/api/v1/']);
+ $request = $this->getRequest(['baseURI' => 'http://www.foo.com/api/v1/']);
$request->get('products');
@@ -90,7 +90,7 @@ public function testGetRemembersBaseURI(): void
*/
public function testGetRemembersBaseURIWithHelperMethod(): void
{
- $request = Services::curlrequest(['base_uri' => 'http://www.foo.com/api/v1/']);
+ $request = Services::curlrequest(['baseURI' => 'http://www.foo.com/api/v1/']);
$uri = $this->getPrivateProperty($request, 'baseURI');
$this->assertSame('www.foo.com', $uri->getHost());
@@ -157,28 +157,17 @@ public function testOptionsSetsCorrectMethod(): void
public function testOptionsBaseURIOption(): void
{
- $options = ['base_uri' => 'http://www.foo.com/api/v1/'];
+ $options = ['baseURI' => 'http://www.foo.com/api/v1/'];
$request = $this->getRequest($options);
$this->assertSame('http://www.foo.com/api/v1/', $request->getBaseURI()->__toString());
}
- public function testOptionsBaseURIOverride(): void
- {
- $options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'baseURI' => 'http://bogus/com',
- ];
- $request = $this->getRequest($options);
-
- $this->assertSame('http://bogus/com', $request->getBaseURI()->__toString());
- }
-
public function testOptionsHeaders(): void
{
$options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'headers' => ['fruit' => 'apple'],
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'headers' => ['fruit' => 'apple'],
];
$request = $this->getRequest();
$this->assertNull($request->header('fruit'));
@@ -195,8 +184,8 @@ public function testOptionsHeadersNotUsingPopulate(): void
$_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip, deflate, br';
$options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'headers' => [
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'headers' => [
'Host' => 'www.foo.com',
'Accept-Encoding' => '',
],
@@ -233,7 +222,7 @@ public function testDefaultOptionsAreSharedBetweenRequests(): void
public function testHeaderContentLengthNotSharedBetweenRequests(): void
{
$options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
+ 'baseURI' => 'http://www.foo.com/api/v1/',
];
$request = $this->getRequest($options);
@@ -253,7 +242,7 @@ public function testHeaderContentLengthNotSharedBetweenClients(): void
$_SERVER['HTTP_CONTENT_LENGTH'] = '10';
$options = [
- 'base_uri' => 'http://www.foo.com/api/v1/',
+ 'baseURI' => 'http://www.foo.com/api/v1/',
];
$request = $this->getRequest($options);
$request->post('example', [
@@ -730,8 +719,8 @@ public function testAllowRedirectsArray(): void
public function testSendWithQuery(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'query' => [
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'query' => [
'name' => 'Henry',
'd.t' => 'value',
],
@@ -747,8 +736,8 @@ public function testSendWithQuery(): void
public function testSendWithDelay(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->get('products');
@@ -760,8 +749,8 @@ public function testSendWithDelay(): void
public function testSendContinued(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setOutput("HTTP/1.1 100 Continue\x0d\x0a\x0d\x0aHi there");
@@ -775,8 +764,8 @@ public function testSendContinued(): void
public function testSendContinuedWithManyHeaders(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$output = "HTTP/1.1 100 Continue
@@ -819,8 +808,8 @@ public function testSendContinuedWithManyHeaders(): void
public function testSendProxied(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$output = "HTTP/1.1 200 Connection established
@@ -834,8 +823,8 @@ public function testSendProxied(): void
public function testSendProxiedWithHTTP10(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$output = "HTTP/1.0 200 Connection established
@@ -852,7 +841,7 @@ public function testSendProxiedWithHTTP10(): void
public function testResponseHeadersWithMultipleRequests(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
+ 'baseURI' => 'http://www.foo.com/api/v1/',
]);
$output = "HTTP/2.0 200 OK
@@ -905,7 +894,7 @@ public function testResponseHeadersWithMultipleRequests(): void
public function testResponseHeadersWithMultipleSetCookies(): void
{
$request = $this->getRequest([
- 'base_uri' => 'https://github.com/',
+ 'baseURI' => 'https://github.com/',
]);
$output = "HTTP/2 200
@@ -937,8 +926,8 @@ public function testResponseHeadersWithMultipleSetCookies(): void
public function testSplitResponse(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setOutput("Accept: text/html\x0d\x0a\x0d\x0aHi there");
@@ -949,8 +938,8 @@ public function testSplitResponse(): void
public function testApplyBody(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setBody('name=George');
@@ -964,8 +953,8 @@ public function testApplyBody(): void
public function testApplyBodyByOptions(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setOutput('Hi there');
@@ -980,8 +969,8 @@ public function testApplyBodyByOptions(): void
public function testBodyIsResetOnSecondRequest(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setBody('name=George');
$request->setOutput('Hi there');
@@ -995,8 +984,8 @@ public function testBodyIsResetOnSecondRequest(): void
public function testResponseHeaders(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setOutput("HTTP/2.0 234 Ohoh\x0d\x0aAccept: text/html\x0d\x0a\x0d\x0aHi there");
@@ -1009,8 +998,8 @@ public function testResponseHeaders(): void
public function testResponseHeadersShortProtocol(): void
{
$request = $this->getRequest([
- 'base_uri' => 'http://www.foo.com/api/v1/',
- 'delay' => 100,
+ 'baseURI' => 'http://www.foo.com/api/v1/',
+ 'delay' => 100,
]);
$request->setOutput("HTTP/2 235 Ohoh\x0d\x0aAccept: text/html\x0d\x0a\x0d\x0aHi there shortie");