diff --git a/alerting/provider/custom/custom.go b/alerting/provider/custom/custom.go index 65b49260..653b76b6 100644 --- a/alerting/provider/custom/custom.go +++ b/alerting/provider/custom/custom.go @@ -31,7 +31,7 @@ func (provider *AlertProvider) ToCustomAlertProvider(service *core.Service, aler return provider } -func (provider *AlertProvider) buildRequest(serviceName, alertDescription string, resolved bool) *http.Request { +func (provider *AlertProvider) buildHTTPRequest(serviceName, alertDescription string, resolved bool) *http.Request { body := provider.Body providerURL := provider.URL method := provider.Method @@ -74,7 +74,7 @@ func (provider *AlertProvider) buildRequest(serviceName, alertDescription string // Send a request to the alert provider and return the body func (provider *AlertProvider) Send(serviceName, alertDescription string, resolved bool) ([]byte, error) { - request := provider.buildRequest(serviceName, alertDescription, resolved) + request := provider.buildHTTPRequest(serviceName, alertDescription, resolved) response, err := client.GetHTTPClient(provider.Insecure).Do(request) if err != nil { return nil, err diff --git a/alerting/provider/custom/custom_test.go b/alerting/provider/custom/custom_test.go index 73e12d3b..56631c48 100644 --- a/alerting/provider/custom/custom_test.go +++ b/alerting/provider/custom/custom_test.go @@ -17,7 +17,7 @@ func TestAlertProvider_IsValid(t *testing.T) { } } -func TestAlertProvider_buildRequestWhenResolved(t *testing.T) { +func TestAlertProvider_buildHTTPRequestWhenResolved(t *testing.T) { const ( ExpectedURL = "http://example.com/service-name?event=RESOLVED&description=alert-description" ExpectedBody = "service-name,alert-description,RESOLVED" @@ -27,7 +27,7 @@ func TestAlertProvider_buildRequestWhenResolved(t *testing.T) { Body: "[SERVICE_NAME],[ALERT_DESCRIPTION],[ALERT_TRIGGERED_OR_RESOLVED]", Headers: nil, } - request := customAlertProvider.buildRequest("service-name", "alert-description", true) + request := customAlertProvider.buildHTTPRequest("service-name", "alert-description", true) if request.URL.String() != ExpectedURL { t.Error("expected URL to be", ExpectedURL, "was", request.URL.String()) } @@ -37,7 +37,7 @@ func TestAlertProvider_buildRequestWhenResolved(t *testing.T) { } } -func TestAlertProvider_buildRequestWhenTriggered(t *testing.T) { +func TestAlertProvider_buildHTTPRequestWhenTriggered(t *testing.T) { const ( ExpectedURL = "http://example.com/service-name?event=TRIGGERED&description=alert-description" ExpectedBody = "service-name,alert-description,TRIGGERED" @@ -47,7 +47,7 @@ func TestAlertProvider_buildRequestWhenTriggered(t *testing.T) { Body: "[SERVICE_NAME],[ALERT_DESCRIPTION],[ALERT_TRIGGERED_OR_RESOLVED]", Headers: map[string]string{"Authorization": "Basic hunter2"}, } - request := customAlertProvider.buildRequest("service-name", "alert-description", false) + request := customAlertProvider.buildHTTPRequest("service-name", "alert-description", false) if request.URL.String() != ExpectedURL { t.Error("expected URL to be", ExpectedURL, "was", request.URL.String()) }