1
0
mirror of synced 2024-11-21 20:46:05 +03:00

Merge pull request #56 from Neur0toxine/master

Feature: initialization with provided http client
This commit is contained in:
Alex Lushpai 2019-10-21 11:03:02 +03:00 committed by GitHub
commit 1130e601c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,
}
}