Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

Commit

Permalink
Call APIInfo.version twice, with and without auth.
Browse files Browse the repository at this point in the history
Refs #8.
  • Loading branch information
AlekSi committed Dec 29, 2015
1 parent 4f3f37c commit 6bd516b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ func (api *API) Version() (v string, err error) {
api.Auth = ""
response, err := api.CallWithError("APIInfo.version", Params{})
api.Auth = auth

// despite what documentation says, Zabbix 2.2 requires auth, so we try again
if e, ok := err.(*Error); ok && e.Code == -32602 {
response, err = api.CallWithError("APIInfo.version", Params{})
}
if err != nil {
return
}
Expand Down

0 comments on commit 6bd516b

Please sign in to comment.