worker: add missing error handling

This commit is contained in:
Conrad Hoffmann 2024-01-21 20:49:18 +01:00 committed by Simon Ser
parent 29f79f49c3
commit 265224537a
1 changed files with 4 additions and 0 deletions

View File

@ -295,6 +295,10 @@ func (ctx *JobContext) processWebhook(def map[string]interface{}) {
ctx.Log.Println("Sending webhook...")
client := &http.Client{Timeout: time.Second * 10}
req, err := http.NewRequest("POST", trigger.Url, bytes.NewReader(data))
if err != nil {
ctx.Log.Printf("Failed to prepare webhook request: %v\n", err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Payload-Nonce", nonce)
req.Header.Add("X-Payload-Signature", sig)