From 56f730eadcc56acdb2b0dae464d04feb2d42ed3e Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Fri, 29 Jun 2018 16:56:22 -0600 Subject: [PATCH] Fix naming of url variables --- itglue.go | 20 ++++++++++---------- organizations.go | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/itglue.go b/itglue.go index 1662d75..061a916 100644 --- a/itglue.go +++ b/itglue.go @@ -45,20 +45,20 @@ func getHTTPResponseBody(resp *http.Response) []byte { //BuildURL expects a restaction to be passed to it //Returns the full request URL containing the ITG API domain prepended to the rest action func (itg *ITGAPI) BuildURL(restAction string) *url.URL { - var URL *url.URL - URL, err := url.Parse(itg.Site) + var itgurl *url.URL + itgurl, err := url.Parse(itg.Site) check(err) - URL.Path += restAction - return URL + itgurl.Path += restAction + return itgurl } //GetRequest allows a custom GET request to the API to be made. //Also used internally by this package by the binding functions //Expects URL to be passed //Returns the response body as a byte slice -func (itg *ITGAPI) GetRequest(URL *url.URL) []byte { +func (itg *ITGAPI) GetRequest(itgurl *url.URL) []byte { client := &http.Client{} - req, err := http.NewRequest("GET", URL.String(), nil) + req, err := http.NewRequest("GET", itgurl.String(), nil) check(err) req.Header.Set("Content-Type", "application/vnd.api+json") req.Header.Set("x-api-key", itg.APIKey) @@ -74,9 +74,9 @@ func (itg *ITGAPI) GetRequest(URL *url.URL) []byte { //Also used internally by this package by the binding functions //Expects a URL and a body to be passed //Returns the response body as a byte slice -func (itg *ITGAPI) PostRequest(URL *url.URL, body io.Reader) []byte { +func (itg *ITGAPI) PostRequest(itgurl *url.URL, body io.Reader) []byte { client := &http.Client{} - req, err := http.NewRequest("POST", URL.String(), body) + req, err := http.NewRequest("POST", itgurl.String(), body) check(err) req.Header.Set("Content-Type", "application/vnd.api+json") req.Header.Set("x-api-key", itg.APIKey) @@ -93,9 +93,9 @@ func (itg *ITGAPI) PostRequest(URL *url.URL, body io.Reader) []byte { //Also used internally by this package by the binding functions //Expects a URL and a body to be passed //Returns the response body as a byte slice -func (itg *ITGAPI) PatchRequest(URL *url.URL, body io.Reader) []byte { +func (itg *ITGAPI) PatchRequest(itgurl *url.URL, body io.Reader) []byte { client := &http.Client{} - req, err := http.NewRequest("PATCH", URL.String(), body) + req, err := http.NewRequest("PATCH", itgurl.String(), body) check(err) req.Header.Set("Content-Type", "application/vnd.api+json") req.Header.Set("x-api-key", itg.APIKey) diff --git a/organizations.go b/organizations.go index 36fbf21..f218033 100644 --- a/organizations.go +++ b/organizations.go @@ -26,9 +26,9 @@ type Organization struct { //GetOrganizationByID expects an ITG organization ID //Returns a pointer to an Organization struct func (itg *ITGAPI) GetOrganizationByID(organizationID int) { - URL := itg.BuildURL(fmt.Sprintf("/organizations/%d", organizationID)) + itgurl := itg.BuildURL(fmt.Sprintf("/organizations/%d", organizationID)) - body := itg.GetRequest(URL) + body := itg.GetRequest(itgurl) fmt.Print(string(body)) //organization := Organization{}