diff --git a/src/Endpoints/CustomHostnames.php b/src/Endpoints/CustomHostnames.php index 6d6733c..7540365 100644 --- a/src/Endpoints/CustomHostnames.php +++ b/src/Endpoints/CustomHostnames.php @@ -34,8 +34,7 @@ class CustomHostnames implements API * @param string $customOriginServer * @param bool $wildcard * @param string $bundleMethod - * @param string $customKey - * @param string $customCertificate + * @param array $customSsl * @return \stdClass */ public function addHostname( @@ -47,8 +46,7 @@ class CustomHostnames implements API string $customOriginServer = '', bool $wildcard = false, string $bundleMethod = '', - string $customKey = '', - string $customCertificate = '' + array $customSsl = [] ): \stdClass { $options = [ 'hostname' => $hostname, @@ -68,12 +66,12 @@ class CustomHostnames implements API $options['ssl']['bundle_method'] = $bundleMethod; } - if (!empty($customKey)) { - $options['ssl']['custom_key'] = $customKey; + if (!empty($customSsl['key'])) { + $options['ssl']['custom_key'] = $customSsl['key']; } - if (!empty($customCertificate)) { - $options['ssl']['custom_certificate'] = $customCertificate; + if (!empty($customSsl['certificate'])) { + $options['ssl']['custom_certificate'] = $customSsl['certificate']; } $zone = $this->adapter->post('zones/'.$zoneID.'/custom_hostnames', $options); diff --git a/tests/Endpoints/CustomHostnamesTest.php b/tests/Endpoints/CustomHostnamesTest.php index fd584e4..276776c 100644 --- a/tests/Endpoints/CustomHostnamesTest.php +++ b/tests/Endpoints/CustomHostnamesTest.php @@ -47,6 +47,7 @@ bsrBsljYfVvtLQzilugs1oEe94LTrYjR2oQt0W24bqpGQHuv1ILuUBuodERkxSFL /cMkj3wSfC341hFaJEuG1+PcxA== -----END PRIVATE KEY----- KEY; + $customCertificate = << 'on', 'min_tls_version' => '1.2' ]; + $hostname->addHostname( '023e105f4ecef8ad9ca31a8372d0c353', 'app.example.com', @@ -110,8 +112,10 @@ CERTIFICATE; 'origin.example.com', true, 'optimal', - $customKey, - $customCertificate + [ + 'key' => $customKey, + 'certificate' => $customCertificate, + ] ); $this->assertEquals('0d89c70d-ad9f-4843-b99f-6cc0252067e9', $hostname->getBody()->result->id); }