refactor(http): set user agent on instance of api.Client instead of package-level global
This commit is contained in:
parent
f52b18cd76
commit
9d82a04727
2 changed files with 3 additions and 4 deletions
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/ayn2op/discordo/internal/http"
|
||||
"github.com/ayn2op/discordo/internal/notifications"
|
||||
"github.com/ayn2op/tview"
|
||||
"github.com/diamondburned/arikawa/v3/api"
|
||||
"github.com/diamondburned/arikawa/v3/gateway"
|
||||
"github.com/diamondburned/arikawa/v3/session"
|
||||
"github.com/diamondburned/arikawa/v3/state"
|
||||
|
|
@ -22,8 +21,6 @@ import (
|
|||
|
||||
func openState(token string) error {
|
||||
identifyProps := http.IdentifyProperties()
|
||||
|
||||
api.UserAgent = http.BrowserUserAgent
|
||||
gateway.DefaultIdentity = identifyProps
|
||||
gateway.DefaultPresence = &gateway.UpdatePresenceCommand{
|
||||
Status: app.cfg.Status,
|
||||
|
|
|
|||
|
|
@ -12,5 +12,7 @@ func NewClient(token string) *api.Client {
|
|||
stdClient := http.DefaultClient
|
||||
stdClient.Transport = NewTransport()
|
||||
httpClient := httputil.NewClientWithDriver(httpdriver.WrapClient(*stdClient))
|
||||
return api.NewCustomClient(token, httpClient)
|
||||
apiClient := api.NewCustomClient(token, httpClient)
|
||||
apiClient.UserAgent = BrowserUserAgent
|
||||
return apiClient
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue