Feature: initialization with provided http client
This commit is contained in:
parent
7db4e02089
commit
2f5017452f
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user