Centralized login logic in func (*Client) makeLoggedInRequest. Also moved setHeaders to func (*Client) makeRequest and changed some headers that are added:
Content-Type should only be set when there's a body, so moved to func (c *Client) Login()
Removed Accept-Encoding, because net/http will handle gzip automatically if the header is unset. The current implementation will fail when the response has a content encoding
Centralized login logic in
func (*Client) makeLoggedInRequest
. Also movedsetHeaders
tofunc (*Client) makeRequest
and changed some headers that are added:func (c *Client) Login()