Added 30 second timeout to API request
This commit is contained in:
parent
474340b082
commit
42ff91e9f9
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue