Return error if NewRequest fails in http output (#4429)
This commit is contained in:
parent
3218ed7e0d
commit
b75d66ff41
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue