diff --git a/plugins/outputs/http/http.go b/plugins/outputs/http/http.go index 198aefe07..e36460ac8 100644 --- a/plugins/outputs/http/http.go +++ b/plugins/outputs/http/http.go @@ -127,6 +127,9 @@ func (h *HTTP) Write(metrics []telegraf.Metric) error { func (h *HTTP) write(reqBody []byte) error { req, err := http.NewRequest(h.Method, h.URL, bytes.NewBuffer(reqBody)) + if err != nil { + return err + } req.Header.Set("Content-Type", defaultContentType) for k, v := range h.Headers {