Merge pull request #52349 from thaJeztah/splunk_requestwithcontext

daemon/logger/splunk: tryPostMessages use http.NewRequestWithContext
This commit is contained in:
Paweł Gronowski
2026-04-16 12:40:35 +02:00
committed by GitHub

View File

@@ -471,11 +471,10 @@ func (l *splunkLogger) tryPostMessages(ctx context.Context, messages []*splunkMe
return err
}
}
req, err := http.NewRequest(http.MethodPost, l.url, bytes.NewBuffer(buffer.Bytes()))
req, err := http.NewRequestWithContext(ctx, http.MethodPost, l.url, bytes.NewBuffer(buffer.Bytes()))
if err != nil {
return err
}
req = req.WithContext(ctx)
req.Header.Set("Authorization", l.auth)
// Tell if we are sending gzip compressed body
if l.gzipCompression {