Skip to content

Commit

Permalink
add timeout for http client
Browse files Browse the repository at this point in the history
  • Loading branch information
hatamiarash7 committed Jul 26, 2023
1 parent 86fa446 commit 8aa70fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/platform/repositories/alert/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"strconv"
"strings"
"time"

"github.com/hatamiarash7/uptime-webhook/internal/models"
log "github.com/sirupsen/logrus"
Expand All @@ -21,7 +22,9 @@ func sendPOSTRequest(url string, payload []byte, version string) (string, error)
}

// Send the request
client := http.Client{}
client := http.Client{
Timeout: 5 * time.Second,
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("User-Agent", "ArvanCloud-Uptime/"+version)
resp, err := client.Do(req)
Expand Down

0 comments on commit 8aa70fc

Please sign in to comment.