From fb0cbdc0bd9b7fcbf0ba178c71f8cb04a778caa5 Mon Sep 17 00:00:00 2001 From: Tyler Date: Tue, 19 Sep 2017 01:09:25 -0400 Subject: [PATCH] Set timeout for requests --- ovrstat.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ovrstat.go b/ovrstat.go index 998bb02..13477ed 100644 --- a/ovrstat.go +++ b/ovrstat.go @@ -6,6 +6,7 @@ import ( "net/http" "fmt" "net/url" + "time" ) type OvrStatApi struct { @@ -20,7 +21,7 @@ func New(apiUrl string) *OvrStatApi { return nil } - return &OvrStatApi{Client: &http.Client{}, URL: u} + return &OvrStatApi{Client: &http.Client{Timeout: 10 * time.Second}, URL: u} } func (s *OvrStatApi) FetchProfile(platform, region, battletag string) (*OwApiResponse, error) {