fix: ionos API content-type
This commit is contained in:
@@ -83,6 +83,8 @@ func (i *IonosAPIImpl) HttpCall(method string, url string, body io.Reader) (*htt
|
||||
}
|
||||
|
||||
req.Header.Add("X-API-Key", i.APIKey)
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
|
||||
return i.HTTPClient.Do(req)
|
||||
}
|
||||
@@ -121,10 +123,10 @@ func (i *IonosAPIImpl) GetRecordId(zoneId string, tld string, subdomain string,
|
||||
json.Unmarshal(responseBody, &zone)
|
||||
|
||||
var domain string
|
||||
if subdomain != "" {
|
||||
domain = subdomain + "." + tld
|
||||
} else {
|
||||
if subdomain == "@" || subdomain == "" {
|
||||
domain = tld
|
||||
} else {
|
||||
domain = subdomain + "." + tld
|
||||
}
|
||||
|
||||
for _, record := range zone.Records {
|
||||
@@ -162,12 +164,14 @@ func (i *IonosAPIImpl) SetARecord(tld string, subdomain string, ip net.IP, ttl i
|
||||
return nil, err
|
||||
}
|
||||
|
||||
responseBody := make([]byte, res.ContentLength)
|
||||
res.Body.Read(responseBody)
|
||||
|
||||
if res.StatusCode != 200 {
|
||||
return nil, errors.New("error updating record")
|
||||
}
|
||||
|
||||
responseBody := make([]byte, res.ContentLength)
|
||||
res.Body.Read(responseBody)
|
||||
|
||||
|
||||
changeRecord := ChangeRecord{}
|
||||
json.Unmarshal(responseBody, &changeRecord)
|
||||
|
||||
Reference in New Issue
Block a user