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("X-API-Key", i.APIKey)
|
||||||
|
req.Header.Add("Content-Type", "application/json")
|
||||||
|
req.Header.Add("Accept", "application/json")
|
||||||
|
|
||||||
return i.HTTPClient.Do(req)
|
return i.HTTPClient.Do(req)
|
||||||
}
|
}
|
||||||
@@ -121,10 +123,10 @@ func (i *IonosAPIImpl) GetRecordId(zoneId string, tld string, subdomain string,
|
|||||||
json.Unmarshal(responseBody, &zone)
|
json.Unmarshal(responseBody, &zone)
|
||||||
|
|
||||||
var domain string
|
var domain string
|
||||||
if subdomain != "" {
|
if subdomain == "@" || subdomain == "" {
|
||||||
domain = subdomain + "." + tld
|
|
||||||
} else {
|
|
||||||
domain = tld
|
domain = tld
|
||||||
|
} else {
|
||||||
|
domain = subdomain + "." + tld
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, record := range zone.Records {
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
responseBody := make([]byte, res.ContentLength)
|
||||||
|
res.Body.Read(responseBody)
|
||||||
|
|
||||||
if res.StatusCode != 200 {
|
if res.StatusCode != 200 {
|
||||||
return nil, errors.New("error updating record")
|
return nil, errors.New("error updating record")
|
||||||
}
|
}
|
||||||
|
|
||||||
responseBody := make([]byte, res.ContentLength)
|
|
||||||
res.Body.Read(responseBody)
|
|
||||||
|
|
||||||
changeRecord := ChangeRecord{}
|
changeRecord := ChangeRecord{}
|
||||||
json.Unmarshal(responseBody, &changeRecord)
|
json.Unmarshal(responseBody, &changeRecord)
|
||||||
|
|||||||
Reference in New Issue
Block a user