Skip to content

Commit

Permalink
Fix auth and pathed URLs for events.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Sep 20, 2024
1 parent 50179b8 commit db17d01
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions http/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"math/rand"
"net"
"net/http"
"net/url"
"strings"
"time"

Expand Down Expand Up @@ -54,14 +53,12 @@ func (s *Service) Events(ctx context.Context, topics []string, handler consensus
}
}

reference, err := url.Parse(fmt.Sprintf("eth/v1/events?topics=%s", strings.Join(topics, "&topics=")))
if err != nil {
return errors.Join(errors.New("invalid endpoint"), err)
}
callURL := s.base.ResolveReference(reference).String()
log.Trace().Str("url", callURL).Msg("GET request to events stream")
endpoint := "/eth/v1/events"
query := "topics=" + strings.Join(topics, "&topics=")
callURL := urlForCall(s.base, endpoint, query)
log.Trace().Str("url", callURL.String()).Msg("GET request to events stream")

client := sse.NewClient(callURL)
client := sse.NewClient(callURL.String())
for k, v := range s.extraHeaders {
client.Headers[k] = v
}
Expand Down

0 comments on commit db17d01

Please sign in to comment.