From f0b712faf865b460b8be7a9edfd78e1b3852cae5 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Jan 2024 01:33:28 -0600 Subject: fix paths Signed-off-by: Jeff Carr --- http.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'http.go') diff --git a/http.go b/http.go index e1865af..b503859 100644 --- a/http.go +++ b/http.go @@ -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) -- cgit v1.2.3