Fix PowerDNS zone URL, add leading slash (#476)

This commit is contained in:
Ian Bishop 2018-02-03 05:32:18 +10:00 committed by xenolf
parent e2b4c3a54f
commit ed69aa0cc6

View file

@ -257,12 +257,11 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM
if c.host.Path != "/" { if c.host.Path != "/" {
path = c.host.Path path = c.host.Path
} }
if c.apiVersion > 0 { if !strings.HasPrefix(uri, "/") {
if !strings.HasPrefix(uri, "api/v") { uri = "/" + uri
uri = "/api/v" + strconv.Itoa(c.apiVersion) + uri }
} else { if c.apiVersion > 0 && !strings.HasPrefix(uri, "/api/v") {
uri = "/" + uri uri = "/api/v" + strconv.Itoa(c.apiVersion) + uri
}
} }
url := c.host.Scheme + "://" + c.host.Host + path + uri url := c.host.Scheme + "://" + c.host.Host + path + uri
req, err := http.NewRequest(method, url, body) req, err := http.NewRequest(method, url, body)