Support MCC charger firmware version 2925 (#713)
The new charger software version 2925 now requires all requests to be a referer value, otherwise all requests will fail with HTTP 401
This commit is contained in:
parent
734839fb16
commit
8ea528ec04
1 changed files with 5 additions and 1 deletions
|
|
@ -127,7 +127,10 @@ func (mcc *MobileConnect) login(password string) error {
|
|||
"pass": []string{mcc.password},
|
||||
}
|
||||
|
||||
req, err := request.New(http.MethodPost, uri, strings.NewReader(data.Encode()), request.URLEncoding)
|
||||
req, err := request.New(http.MethodPost, uri, strings.NewReader(data.Encode()), map[string]string{
|
||||
"Referer": fmt.Sprintf("%s/login", mcc.uri),
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -172,6 +175,7 @@ func (mcc *MobileConnect) request(method, uri string) (*http.Request, error) {
|
|||
}
|
||||
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", mcc.token))
|
||||
req.Header.Set("Referer", fmt.Sprintf("%s/dashboard", mcc.uri))
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue