From f81d05226fe61b697baa91e926dd86efad9d8084 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 19 Aug 2022 16:30:58 +0200 Subject: HTTP: Set a default timeout of 5 seconds --- internal/http/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/http/http.go') diff --git a/internal/http/http.go b/internal/http/http.go index 3c8e4e1..ae791a9 100644 --- a/internal/http/http.go +++ b/internal/http/http.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "strings" + "time" "github.com/jwijenbergh/eduvpn-common/internal/types" ) @@ -91,7 +92,7 @@ func HTTPMethodWithOpts(method string, url string, opts *HTTPOptionalParams) (ht } // Create a client - client := &http.Client{} + client := &http.Client{Timeout: 5 * time.Second} errorMessage := fmt.Sprintf("failed HTTP request with method %s and url %s", method, url) -- cgit v1.2.3