feat:#52 added lower timeout for http request

This commit is contained in:
masterElmar
2023-11-30 23:38:18 +01:00
parent c9caa2aedc
commit 03d393c7d9

View File

@@ -4,14 +4,20 @@ import (
"fmt"
"io"
"net/http"
"time"
)
// getPlanHTML Get the HTML document from the specified URL
func GetHTML(url string) (string, error) {
// Create HTTP client with timeout of 5 seconds
client := http.Client{
Timeout: 30 * time.Second,
}
// Send GET request
response, err := http.Get(url)
response, err := client.Get(url)
if err != nil {
fmt.Printf("Error occurred while making the request: %s\n", err.Error())
return "", err