Merge pull request #56 from Neur0toxine/master
Feature: initialization with provided http client
This commit is contained in:
commit
1130e601c1
@ -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