in internal/components/trigger/http.go [43:67]
func NewHTTPAction(intervalStr string, times int, url, method, body string, headers map[string]string) (Action, error) {
interval, err := time.ParseDuration(intervalStr)
if err != nil {
return nil, err
}
if interval <= 0 {
return nil, fmt.Errorf("trigger interval should be > 0, but was %s", interval)
}
// there can be env variables in url, say, "http://${GATEWAY_HOST}:${GATEWAY_PORT}/test"
url = os.ExpandEnv(url)
return &httpAction{
interval: interval,
times: times,
url: url,
method: strings.ToUpper(method),
body: body,
headers: headers,
executedCount: 0,
stopCh: make(chan struct{}),
client: &http.Client{},
}, nil
}