mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-18 21:02:56 +02:00
add a default user-agent: github.com/nbd-wtf/go-nostr.
fixes https://github.com/nbd-wtf/go-nostr/issues/147
This commit is contained in:
parent
a54852f439
commit
515f76bd86
7
relay.go
7
relay.go
@ -160,6 +160,13 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error
|
|||||||
defer cancel()
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
conn, err := NewConnection(ctx, r.URL, r.RequestHeader, tlsConfig)
|
conn, err := NewConnection(ctx, r.URL, r.RequestHeader, tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error opening websocket to '%s': %w", r.URL, err)
|
return fmt.Errorf("error opening websocket to '%s': %w", r.URL, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user