Set timeout for requests

This commit is contained in:
Tyler 2017-09-19 01:09:25 -04:00
parent fc504daaa6
commit fb0cbdc0bd
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"net/http" "net/http"
"fmt" "fmt"
"net/url" "net/url"
"time"
) )
type OvrStatApi struct { type OvrStatApi struct {
@ -20,7 +21,7 @@ func New(apiUrl string) *OvrStatApi {
return nil 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) { func (s *OvrStatApi) FetchProfile(platform, region, battletag string) (*OwApiResponse, error) {