package http_notifier import ( "fmt" "net/http" "slices" ) type HTTPNotifier struct{} func NewNotifier() *HTTPNotifier { return &HTTPNotifier{} } func (n *HTTPNotifier) Notify(url string) error { resp, err := http.Get(url) if err != nil { return fmt.Errorf("Failed to call URL %s: %s", url, err.Error()) } defer resp.Body.Close() if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusNoContent}, resp.StatusCode) { return fmt.Errorf("Unexpected status code %d from URL %s", resp.StatusCode, url) } return nil }