Set a timeout for requests.

This commit is contained in:
Kavin 2023-07-26 21:31:31 +01:00
parent 20e5350736
commit 9e4c9e9d8c
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F
1 changed files with 5 additions and 1 deletions

View File

@ -44,8 +44,12 @@ type FrontendConfig struct {
S3Enabled bool `json:"s3Enabled"`
}
var client = http.Client{
Timeout: 10 * time.Second,
}
func testUrl(url string) (*http.Response, error) {
resp, err := http.Get(url)
resp, err := client.Get(url)
if err != nil {
return resp, err
}