1
0
mirror of synced 2024-11-22 13:06:05 +03:00

Feature: initialization with provided http client

This commit is contained in:
Pavel 2019-10-18 17:02:41 +03:00
parent 7db4e02089
commit 2f5017452f

View File

@ -15,10 +15,15 @@ import (
// New initialize client // New initialize client
func New(url string, token string) *MgClient { func New(url string, token string) *MgClient {
return NewWithClient(url, token, &http.Client{Timeout: time.Minute})
}
// NewWithClient initializes client with provided http client
func NewWithClient(url string, token string, client *http.Client) *MgClient {
return &MgClient{ return &MgClient{
URL: url, URL: url,
Token: token, Token: token,
httpClient: &http.Client{Timeout: time.Minute}, httpClient: client,
} }
} }