|
|
@ -142,15 +142,14 @@ func (target *WebhookTarget) send(eventData event.Event) error { |
|
|
|
|
|
|
|
|
|
|
|
resp, err := target.httpClient.Do(req) |
|
|
|
resp, err := target.httpClient.Do(req) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
target.Close() |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
defer resp.Body.Close() |
|
|
|
defer resp.Body.Close() |
|
|
|
io.Copy(ioutil.Discard, resp.Body) |
|
|
|
io.Copy(ioutil.Discard, resp.Body) |
|
|
|
|
|
|
|
|
|
|
|
if resp.StatusCode < 200 || resp.StatusCode > 299 { |
|
|
|
if resp.StatusCode < 200 || resp.StatusCode > 299 { |
|
|
|
// close any idle connections upon any error.
|
|
|
|
target.Close() |
|
|
|
target.httpClient.CloseIdleConnections() |
|
|
|
|
|
|
|
return fmt.Errorf("sending event failed with %v", resp.Status) |
|
|
|
return fmt.Errorf("sending event failed with %v", resp.Status) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|