diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa84d6e..19cf3743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +dev: + - add client headers for events stream + 0.21.7: - use POST for specific validator and validator balance information diff --git a/http/events.go b/http/events.go index fbaaace8..849adffe 100644 --- a/http/events.go +++ b/http/events.go @@ -62,6 +62,12 @@ func (s *Service) Events(ctx context.Context, topics []string, handler consensus log.Trace().Str("url", callURL).Msg("GET request to events stream") client := sse.NewClient(callURL) + for k, v := range s.extraHeaders { + client.Headers[k] = v + } + if _, exists := client.Headers["User-Agent"]; !exists { + client.Headers["User-Agent"] = defaultUserAgent + } client.Connection.Transport = &http.Transport{ Dial: (&net.Dialer{ Timeout: 2 * time.Second,