Files
BanForge/internal/actions/webhooks.go
d3m0k1d 66d460dbfc
All checks were successful
build / build (push) Successful in 2m23s
feat: add simple actions without integration to another code
2026-02-23 20:03:40 +03:00

25 lines
457 B
Go

package actions
import (
"bytes"
"net/http"
"time"
)
func SendWebhook(url string, data []byte) (int, error) {
client := &http.Client{
Timeout: 30 * time.Second,
}
req, err := http.NewRequest("POST", url, bytes.NewReader(data))
if err != nil {
return 0, err
}
req.Header.Set("Content-Type", "application/json")
// #nosec G704 validating by admin
resp, err := client.Do(req)
if err != nil {
return 0, err
}
return resp.StatusCode, nil
}