-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for setting a custom HTTP client #9
Conversation
Given the hiccups with the CLA and need for a fix, I went ahead and created this pull request. I would appreciate a quick review to ensure this will do what you need. For reference, this closes: |
Looks good to me. Thanks for porting! |
|
||
func TestCustomHTTPClient(t *testing.T) { | ||
fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
time.Sleep(time.Second * 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These timeouts can be shorter - try 10ms & 20ms.
LGTM |
BaseURL: baseURL, | ||
} | ||
customClient := &Client{&http.Client{Timeout: time.Second * 1}} | ||
_, e := customClient.API(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/e/err/
if _, err := customClient.API(request); err == nil {
t.Error("got nil, want non-nil err")
}
Thanks for the feedback! I'll make the suggested changes here and get this deployed and update the dependency in sendgrid-go. |
Thank you so much for your support and help on this! Please send us your mailing address and T-shirt size ([email protected]) so we can give you a small token of our appreciation. |
woohoo! |
No description provided.