WithUserAgent() pool option.

This commit is contained in:
fiatjaf
2024-09-26 19:18:34 -03:00
parent 2edc0fb713
commit 0caf8deb56
2 changed files with 16 additions and 5 deletions

View File

@@ -66,6 +66,7 @@ func NewRelay(ctx context.Context, url string, opts ...RelayOption) *Relay {
ok, _ := e.CheckSignature()
return ok
},
RequestHeader: make(http.Header, 1),
}
for _, opt := range opts {
@@ -160,9 +161,6 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error
defer cancel()
}
if r.RequestHeader == nil {
r.RequestHeader = make(http.Header, 1)
}
if r.RequestHeader.Get("User-Agent") == "" {
r.RequestHeader.Set("User-Agent", "github.com/nbd-wtf/go-nostr")
}