Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ func (builder *ClientBuilder) Connect() (session *Session, err error) {
// Check if any cache was defined and if it has a valid cached session
if builder.hasCache && builder.cache.HasSession() {
if session, err = builder.cache.GetSession(); err == nil {
session.client = builder.client
session.Client = builder.client
return session, nil
}
}

// Otherwise - login to a Zabbix server
session = &Session{URL: builder.url, client: builder.client}
session = &Session{URL: builder.url, Client: builder.client}
err = session.login(builder.credentials["username"], builder.credentials["password"])

if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/cavaliercoder/go-zabbix

go 1.13
4 changes: 2 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Session struct {
// ApiVersion is the software version string of the connected Zabbix API.
APIVersion string `json:"apiVersion"`

client *http.Client
Client *http.Client
}

// NewSession returns a new Session given an API connection URL and an API
Expand Down Expand Up @@ -122,7 +122,7 @@ func (c *Session) Do(req *Request) (resp *Response, err error) {
r.Header.Add("Content-Type", "application/json-rpc")

// send request
client := c.client
client := c.Client
if client == nil {
client = http.DefaultClient
}
Expand Down