Skip to content

Commit dee9534

Browse files
committed
fix: add HTTP client timeout for webhook requests
1 parent 86f9d00 commit dee9534

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/utils/httpreq/httpreq.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"net/http"
8+
"time"
89

910
jsoniter "github.com/json-iterator/go"
1011
)
@@ -13,9 +14,14 @@ type Client struct {
1314
httpClient *http.Client
1415
}
1516

17+
const defaultTimeout = 10 * time.Second
18+
1619
func NewClient() *Client {
1720
return &Client{
18-
httpClient: http.DefaultClient,
21+
httpClient: &http.Client{
22+
Transport: http.DefaultClient.Transport,
23+
Timeout: defaultTimeout,
24+
},
1925
}
2026
}
2127

0 commit comments

Comments
 (0)