Skip to content
Snippets Groups Projects
Commit 0b9066f3 authored by Aksel Baardsen's avatar Aksel Baardsen
Browse files

added global http client

parent c0cb5b6a
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,11 @@ import (
"time"
)
// creates http client for ensuring timely timeouts
var client = http.Client{
Timeout: 5 * time.Second,
}
// allowing access to "overloaded" functions
func unfold(m mashup, response *http.Response) error {
return m.unmarshal(response)
......@@ -39,11 +44,6 @@ func (s *Specie) unmarshal(resp *http.Response) error {
// parses http.response as a string used later for parsing
func getBody(url string, m mashup) error {
// creates a client to allow for timeout
client := http.Client{
Timeout: 4 * time.Second,
}
// sends a http request
resp, err := client.Get(url)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment