Skip to content

Commit

Permalink
Add client headers for events stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Jul 22, 2024
1 parent 5f15ea2 commit 0138132
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
dev:
- add client headers for events stream

0.21.7:
- use POST for specific validator and validator balance information

Expand Down
6 changes: 6 additions & 0 deletions http/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0138132

Please sign in to comment.