func main() { client := http.Client{ Transport: httplogger.NewLoggedTransport(http.DefaultTransport, newLogger()), } client.Get("http://google.com") }
// NewClient return a new Client func NewClient(apiUrl, apiKey string, httpClients ...*http.Client) *Client { var httpClient *http.Client if len(httpClients) > 0 { httpClient = httpClients[0] } else { httpClient = &http.Client{ Transport: httplogger.NewLoggedTransport(http.DefaultTransport, newLogger()), } } base := sling.New().Client(httpClient).Base(apiUrl).Set("X-Dostow-Group-Access-Key", apiKey) return &Client{ sling: base, Schema: newSchemaService(base.New()), Auth: newAuthService(base.New()), Store: newStoreService(base.New()), } }