From 04e889c4446689c460721e090bf0ed9fc91d83d2 Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Fri, 3 Aug 2018 15:00:17 -0600 Subject: [PATCH] Better comments in requests.go to explain user impersonation --- 3.0/connectwise/requests.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/3.0/connectwise/requests.go b/3.0/connectwise/requests.go index e59ef3a..69accf4 100644 --- a/3.0/connectwise/requests.go +++ b/3.0/connectwise/requests.go @@ -64,7 +64,8 @@ func (req *Request) Do() error { return fmt.Errorf("could not build url %s: %s", req.RestAction, err) } - //If pagination parameters are not being specified, then don't include them in the URL - not all endpoints will accept page and pagesize, they will 400 - bad request + //If pagination parameters are not being specified, then don't include them in the URL + //Not all endpoints will accept page and pagesize, they return http status 400 - bad request if req.Page == 0 || req.PageSize == 0 { cwurl.RawQuery = req.URLValues.Encode() } else { @@ -77,9 +78,9 @@ func (req *Request) Do() error { if err != nil { return fmt.Errorf("could not construct http request: %s", err) } - if req.CW.AuthAPIKey != "" { + if req.CW.AuthAPIKey != "" { //Standard API keys httpreq.Header.Set("Authorization", req.CW.AuthAPIKey) - } else { //User impersonation + } else { //User impersonation using username + password cookieCompanyName := http.Cookie{Name: "companyName", Value: req.CW.CompanyName} cookieMemberHash := http.Cookie{Name: "memberHash", Value: req.CW.AuthMemberHash} cookieMemberID := http.Cookie{Name: "memberID", Value: req.CW.AuthUsername}