From dee9534795b06f88e73dfed12189e433bf02a3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Mon, 6 Apr 2026 18:22:15 +0530 Subject: [PATCH] fix: add HTTP client timeout for webhook requests --- pkg/utils/httpreq/httpreq.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go index 621b230..f15635c 100644 --- a/pkg/utils/httpreq/httpreq.go +++ b/pkg/utils/httpreq/httpreq.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "net/http" + "time" jsoniter "github.com/json-iterator/go" ) @@ -13,9 +14,14 @@ type Client struct { httpClient *http.Client } +const defaultTimeout = 10 * time.Second + func NewClient() *Client { return &Client{ - httpClient: http.DefaultClient, + httpClient: &http.Client{ + Transport: http.DefaultClient.Transport, + Timeout: defaultTimeout, + }, } }