Added 30 second timeout to API request

This commit is contained in:
tyler 2024-01-06 11:39:59 -05:00
parent 474340b082
commit 42ff91e9f9

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"time"
) )
type Follower struct { type Follower struct {
@ -93,7 +94,8 @@ type LivestreamResponse struct {
} }
func (c *Client) Request() (*LivestreamResponse, error) { 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 { if err != nil {
return nil, pkgErr("http Get request returned error", err) return nil, pkgErr("http Get request returned error", err)
} }