diff --git a/bridge/zulip/zulip.go b/bridge/zulip/zulip.go index 56b5afbac7..729c8fb6b7 100644 --- a/bridge/zulip/zulip.go +++ b/bridge/zulip/zulip.go @@ -29,7 +29,7 @@ func New(cfg *bridge.Config) bridge.Bridger { } func (b *Bzulip) Connect() error { - bot := gzb.Bot{APIKey: b.GetString("token"), APIURL: b.GetString("server") + "/api/v1/", Email: b.GetString("login")} + bot := gzb.Bot{APIKey: b.GetString("token"), APIURL: b.GetString("server") + "/api/v1/", Email: b.GetString("login"), UserAgent: fmt.Sprintf("matterbridge/%s", version.Release)} bot.Init() q, err := bot.RegisterAll() b.q = q diff --git a/vendor/github.com/matterbridge/gozulipbot/bot.go b/vendor/github.com/matterbridge/gozulipbot/bot.go index ae642f6073..1130e2a1c0 100644 --- a/vendor/github.com/matterbridge/gozulipbot/bot.go +++ b/vendor/github.com/matterbridge/gozulipbot/bot.go @@ -10,14 +10,15 @@ import ( ) type Bot struct { - APIKey string - APIURL string - Email string - Queues []*Queue - Streams []string - Client Doer - Backoff time.Duration - Retries int64 + APIKey string + APIURL string + Email string + Queues []*Queue + Streams []string + Client Doer + Backoff time.Duration + Retries int64 + UserAgent string } type Doer interface { @@ -260,6 +261,9 @@ func (b *Bot) constructRequest(method, endpoint, body string) (*http.Request, er } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + if b.UserAgent != "" { + req.Header.Set("User-Agent", b.UserAgent) + } req.SetBasicAuth(b.Email, b.APIKey) return req, nil