forked from TrueCloudLab/lego
Prevent sending empty body in OTC DNS Provider (#903)
This commit is contained in:
parent
99741b0b92
commit
346d3222d7
1 changed files with 8 additions and 4 deletions
|
@ -230,12 +230,16 @@ func (d *DNSProvider) deleteRecordSet(zoneID, recordID string) error {
|
||||||
func (d *DNSProvider) sendRequest(method, resource string, payload interface{}) (io.Reader, error) {
|
func (d *DNSProvider) sendRequest(method, resource string, payload interface{}) (io.Reader, error) {
|
||||||
url := fmt.Sprintf("%s/%s", d.baseURL, resource)
|
url := fmt.Sprintf("%s/%s", d.baseURL, resource)
|
||||||
|
|
||||||
body, err := json.Marshal(payload)
|
var body io.Reader
|
||||||
if err != nil {
|
if payload != nil {
|
||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue