chore: simplify
This commit is contained in:
parent
562c702c59
commit
15d9c4a59a
3 changed files with 5 additions and 5 deletions
|
|
@ -227,9 +227,9 @@ func (c *Easee) connect(ts oauth2.TokenSource) func() (signalr.Connection, error
|
|||
|
||||
return signalr.NewHTTPConnection(ctx, "https://streams.easee.com/hubs/chargers",
|
||||
signalr.WithHTTPClient(c.Client),
|
||||
signalr.WithHTTPHeaders(func() (res http.Header) {
|
||||
signalr.WithHTTPHeaders(func() http.Header {
|
||||
return http.Header{
|
||||
"Authorization": []string{fmt.Sprintf("Bearer %s", tok.AccessToken)},
|
||||
"Authorization": []string{"Bearer " + tok.AccessToken},
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ func (mcc *MobileConnect) refresh() error {
|
|||
}
|
||||
|
||||
req.Header.Set("Referer", fmt.Sprintf("%s/login", mcc.uri))
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", mcc.token))
|
||||
req.Header.Set("Authorization", "Bearer "+mcc.token)
|
||||
|
||||
return mcc.fetchToken(req)
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ func (mcc *MobileConnect) request(method, uri string) (*http.Request, error) {
|
|||
return req, err
|
||||
}
|
||||
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", mcc.token))
|
||||
req.Header.Set("Authorization", "Bearer "+mcc.token)
|
||||
req.Header.Set("Referer", fmt.Sprintf("%s/dashboard", mcc.uri))
|
||||
|
||||
return req, nil
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ func NewAmberFromConfig(other map[string]interface{}) (api.Tariff, error) {
|
|||
t.Client.Transport = &transport.Decorator{
|
||||
Base: t.Client.Transport,
|
||||
Decorator: transport.DecorateHeaders(map[string]string{
|
||||
"Authorization": fmt.Sprintf("Bearer %s", cc.Token),
|
||||
"Authorization": "Bearer " + cc.Token,
|
||||
}),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue