Set HTTP client timeout to 30 seconds (#153)
* Set HTTP client timeout to 30 seconds * Add an explanation for why we set http.Server's Timeout
This commit is contained in:
parent
5da967b88c
commit
2c5b038df2
|
|
@ -20,6 +20,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"nhooyr.io/websocket"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -77,6 +78,11 @@ func New(opts ...Option) (*Client, error) {
|
|||
|
||||
// Instantiate the HTTP client
|
||||
client.httpClient = &http.Client{
|
||||
// The default is zero, which means no timeout, which means that
|
||||
// the requests may hang indefinitely. See [1] for more details.
|
||||
//
|
||||
// [1]: https://github.com/cirruslabs/orchard/issues/152#issuecomment-1927091747
|
||||
Timeout: 30 * time.Second,
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: client.tlsConfig,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue