@@ -528,6 +528,64 @@ func TestUpdateDNSRecord(t *testing.T) {
528528 require .NoError (t , err )
529529}
530530
531+ func TestUpdateDNSRecord_ClearComment (t * testing.T ) {
532+ setup ()
533+ defer teardown ()
534+
535+ input := DNSRecord {
536+ ID : "372e67954025e0ba6aaa6d586b9e0b59" ,
537+ Comment : "" ,
538+ }
539+
540+ handler := func (w http.ResponseWriter , r * http.Request ) {
541+ assert .Equal (t , http .MethodPatch , r .Method , "Expected method 'PATCH', got %s" , r .Method )
542+
543+ var v DNSRecord
544+ err := json .NewDecoder (r .Body ).Decode (& v )
545+ require .NoError (t , err )
546+ v .ID = "372e67954025e0ba6aaa6d586b9e0b59"
547+ assert .Equal (t , input , v )
548+
549+ w .Header ().Set ("content-type" , "application/json" )
550+ fmt .Fprint (w , `{
551+ "success": true,
552+ "errors": [],
553+ "messages": [],
554+ "result": {
555+ "id": "372e67954025e0ba6aaa6d586b9e0b59",
556+ "type": "A",
557+ "name": "example.com",
558+ "content": "198.51.100.4",
559+ "proxiable": true,
560+ "proxied": false,
561+ "ttl": 120,
562+ "locked": false,
563+ "zone_id": "d56084adb405e0b7e32c52321bf07be6",
564+ "zone_name": "example.com",
565+ "created_on": "2014-01-01T05:20:00Z",
566+ "modified_on": "2014-01-01T05:20:00Z",
567+ "comment":null,
568+ "tags":[],
569+ "data": {},
570+ "meta": {
571+ "auto_added": true,
572+ "source": "primary"
573+ }
574+ }
575+ }` )
576+ }
577+
578+ dnsRecordID := "372e67954025e0ba6aaa6d586b9e0b59"
579+
580+ mux .HandleFunc ("/zones/" + testZoneID + "/dns_records/" + dnsRecordID , handler )
581+
582+ err := client .UpdateDNSRecord (context .Background (), ZoneIdentifier (testZoneID ), UpdateDNSRecordParams {
583+ ID : dnsRecordID ,
584+ Comment : "" ,
585+ })
586+ require .NoError (t , err )
587+ }
588+
531589func TestDeleteDNSRecord (t * testing.T ) {
532590 setup ()
533591 defer teardown ()
0 commit comments