web: Add timeout on get requests

This commit is contained in:
Lucas BEE 2019-04-17 17:30:41 +02:00
parent 97057b43c3
commit 1ecdfc2ba5

View File

@ -7,6 +7,7 @@ import (
"net/http"
"os"
"path"
"time"
"github.com/nfnt/resize"
)
@ -17,7 +18,10 @@ var Download = func(srcURL, dest string) error {
return err
}
resp, err := http.Get(srcURL)
var httpClient = &http.Client{
Timeout: time.Second * 10,
}
resp, err := httpClient.Get(srcURL)
if err != nil {
return err
}