diff --git a/backend/service/fetch/htmlDownloader.go b/backend/service/fetch/htmlDownloader.go index 8bd4d42..c69817e 100644 --- a/backend/service/fetch/htmlDownloader.go +++ b/backend/service/fetch/htmlDownloader.go @@ -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