diff options
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,10 +1,10 @@ // This is a simple example package cloudflare -import ( +import ( + "bytes" "io/ioutil" "net/http" - "bytes" "go.wit.com/log" ) @@ -49,7 +49,7 @@ func doCurlDelete(auth string, email string, zoneId string, rrId string) string // Set headers req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer " + auth) + req.Header.Set("Authorization", "Bearer "+auth) // changed from this 2024-01-05 // req.Header.Set("X-Auth-Key", auth) // req.Header.Set("X-Auth-Email", email) @@ -87,11 +87,11 @@ func doCurlCreate(auth string, email string, zoneId string, data string) string log.Log(CURL, "doCurlCreate() POST Email =", email) log.Log(CURL, "doCurlCreate() POST data =", data) - req, err = http.NewRequest(http.MethodPost, url, bytes.NewBuffer( []byte(data) )) + req, err = http.NewRequest(http.MethodPost, url, bytes.NewBuffer([]byte(data))) // Set headers req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer " + auth) + req.Header.Set("Authorization", "Bearer "+auth) client := &http.Client{} resp, err := client.Do(req) @@ -118,7 +118,7 @@ func doCurl(method string, rr *RRT) string { data := []byte(rr.data) - if (method == "PUT") { + if method == "PUT" { req, err = http.NewRequest(http.MethodPut, rr.url, bytes.NewBuffer(data)) } else { req, err = http.NewRequest(http.MethodPost, rr.url, bytes.NewBuffer(data)) @@ -126,7 +126,7 @@ func doCurl(method string, rr *RRT) string { // Set headers req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer " + rr.Auth) + req.Header.Set("Authorization", "Bearer "+rr.Auth) log.Log(CURL, "http PUT url =", rr.url) log.Log(CURL, "http PUT Auth =", rr.Auth) @@ -166,7 +166,7 @@ func curlPost(dnsRow *RRT) string { // Set headers req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer " + authKey) + req.Header.Set("Authorization", "Bearer "+authKey) client := &http.Client{} resp, err := client.Do(req) |
