1
0
mirror of synced 2024-11-25 06:26:03 +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
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{
URL: url,
Token: token,
httpClient: &http.Client{Timeout: time.Minute},
httpClient: client,
}
}