diff --git a/providers/dns/otc/client.go b/providers/dns/otc/client.go index 1cd71f55..fa4c5edc 100644 --- a/providers/dns/otc/client.go +++ b/providers/dns/otc/client.go @@ -230,12 +230,16 @@ func (d *DNSProvider) deleteRecordSet(zoneID, recordID string) error { func (d *DNSProvider) sendRequest(method, resource string, payload interface{}) (io.Reader, error) { url := fmt.Sprintf("%s/%s", d.baseURL, resource) - body, err := json.Marshal(payload) - if err != nil { - return nil, err + var body io.Reader + if payload != nil { + content, err := json.Marshal(payload) + if err != nil { + return nil, err + } + body = bytes.NewReader(content) } - req, err := http.NewRequest(method, url, bytes.NewReader(body)) + req, err := http.NewRequest(method, url, body) if err != nil { return nil, err }