From 42ff91e9f9c4d55b5d17778d2b9d231430d30c74 Mon Sep 17 00:00:00 2001 From: tyler Date: Sat, 6 Jan 2024 11:39:59 -0500 Subject: [PATCH] Added 30 second timeout to API request --- livestream.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/livestream.go b/livestream.go index aff4cd6..a36d109 100644 --- a/livestream.go +++ b/livestream.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "time" ) type Follower struct { @@ -93,7 +94,8 @@ type LivestreamResponse struct { } func (c *Client) Request() (*LivestreamResponse, error) { - resp, err := http.Get(c.StreamKey) + hcl := http.Client{Timeout: 30 * time.Second} + resp, err := hcl.Get(c.StreamKey) if err != nil { return nil, pkgErr("http Get request returned error", err) }