@@ -119,8 +119,8 @@ func TestCustomHostname_CreateCustomHostname_CustomOrigin(t *testing.T) {
119119
120120 want := & CustomHostnameResponse {
121121 Result : CustomHostname {
122- ID : "0d89c70d-ad9f-4843-b99f-6cc0252067e9" ,
123- Hostname : "app.example.com" ,
122+ ID : "0d89c70d-ad9f-4843-b99f-6cc0252067e9" ,
123+ Hostname : "app.example.com" ,
124124 CustomOriginServer : "example.app.com" ,
125125 SSL : CustomHostnameSSL {
126126 Type : "dv" ,
@@ -250,3 +250,63 @@ func TestCustomHostname_CustomHostname(t *testing.T) {
250250 assert .Equal (t , want , customHostname )
251251 }
252252}
253+
254+ func TestCustomHostname_UpdateCustomHostnameSSL (t * testing.T ) {
255+ setup ()
256+ defer teardown ()
257+
258+ mux .HandleFunc ("/zones/foo/custom_hostnames/0d89c70d-ad9f-4843-b99f-6cc0252067e9" , func (w http.ResponseWriter , r * http.Request ) {
259+ assert .Equal (t , "PATCH" , r .Method , "Expected method 'PATCH', got %s" , r .Method )
260+
261+ w .Header ().Set ("content-type" , "application/json" )
262+ w .WriteHeader (http .StatusCreated )
263+ fmt .Fprintf (w , `
264+ {
265+ "success": true,
266+ "errors": [],
267+ "messages": [],
268+ "result": {
269+ "id": "0d89c70d-ad9f-4843-b99f-6cc0252067e9",
270+ "hostname": "app.example.com",
271+ "custom_origin_server": "example.app.com",
272+ "ssl": {
273+ "status": "pending_validation",
274+ "method": "cname",
275+ "type": "dv",
276+ "cname_target": "dcv.digicert.com",
277+ "cname": "810b7d5f01154524b961ba0cd578acc2.app.example.com",
278+ "settings": {
279+ "http2": "off",
280+ "tls_1_3": "on"
281+ }
282+ }
283+ }
284+ }` )
285+ })
286+
287+ response , err := client .UpdateCustomHostnameSSL ("foo" , "0d89c70d-ad9f-4843-b99f-6cc0252067e9" , CustomHostnameSSL {Method : "cname" , Type : "dv" , Settings : CustomHostnameSSLSettings {HTTP2 : "off" , TLS13 : "on" }})
288+
289+ want := & CustomHostnameResponse {
290+ Result : CustomHostname {
291+ ID : "0d89c70d-ad9f-4843-b99f-6cc0252067e9" ,
292+ Hostname : "app.example.com" ,
293+ CustomOriginServer : "example.app.com" ,
294+ SSL : CustomHostnameSSL {
295+ Type : "dv" ,
296+ Method : "cname" ,
297+ Status : "pending_validation" ,
298+ CnameTarget : "dcv.digicert.com" ,
299+ CnameName : "810b7d5f01154524b961ba0cd578acc2.app.example.com" ,
300+ Settings : CustomHostnameSSLSettings {
301+ HTTP2 : "off" ,
302+ TLS13 : "on" ,
303+ },
304+ },
305+ },
306+ Response : Response {Success : true , Errors : []ResponseInfo {}, Messages : []ResponseInfo {}},
307+ }
308+
309+ if assert .NoError (t , err ) {
310+ assert .Equal (t , want , response )
311+ }
312+ }
0 commit comments