less is more

This commit is contained in:
David Newhall II 2019-06-19 00:40:25 -07:00
parent 4e56ad4d2b
commit 638e16f2b0
1 changed files with 4 additions and 4 deletions

View File

@ -141,12 +141,12 @@ func (u *Unifi) GetSites() (Sites, error) {
// GetData makes a unifi request and unmarshal the response into a provided pointer. // GetData makes a unifi request and unmarshal the response into a provided pointer.
func (u *Unifi) GetData(methodPath string, v interface{}) error { func (u *Unifi) GetData(methodPath string, v interface{}) error {
if body, err := u.GetJSON(methodPath); err != nil { body, err := u.GetJSON(methodPath)
if err != nil {
return err return err
} else if err = json.Unmarshal(body, v); err != nil {
return errors.Wrapf(err, "json.Unmarshal(%s)", methodPath)
} }
return nil err = json.Unmarshal(body, v)
return errors.Wrapf(err, "json.Unmarshal(%s)", methodPath)
} }
// UniReq is a small helper function that adds an Accept header. // UniReq is a small helper function that adds an Accept header.