Create generic BuildUrl function to reduce the need to go through all the net/url crap each time

This commit is contained in:
2018-06-22 18:47:39 -06:00
parent a66ba7ca89
commit 4eaca267d9
7 changed files with 30 additions and 61 deletions

View File

@ -9,6 +9,15 @@ import (
"net/url"
)
func BuildUrl(site *ConnectwiseSite, restAction string) *url.URL {
var Url *url.URL
Url, err := url.Parse(site.Site)
check(err)
Url.Path += restAction
return Url
}
//Checks for HTTP errors, and if all looks good, returns the body of the HTTP response as a byte slice
//TBD: Needs to accept 201 and 204 (returned for Create and Delete operations)
func getHTTPResponseBody(resp *http.Response) []byte {