Skip to content

Commit

Permalink
horizonclient: add version (#1229)
Browse files Browse the repository at this point in the history
* add package version

* fix go fmt
  • Loading branch information
poliha authored and ire-and-curses committed May 2, 2019
1 parent 9888eb5 commit 9580c77
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clients/horizonclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/manucorporat/sse"
hProtocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/protocols/horizon/operations"
"github.com/stellar/go/support/app"
"github.com/stellar/go/support/errors"
)

Expand Down Expand Up @@ -94,7 +93,6 @@ func (c *Client) stream(
}
req.Header.Set("Accept", "text/event-stream")
c.setDefaultClient()
// to do: confirm name and version
c.setClientAppHeaders(req)

// We can use c.HTTP here because we set Timeout per request not on the client. See sendRequest()
Expand Down Expand Up @@ -199,7 +197,7 @@ func (c *Client) stream(

func (c *Client) setClientAppHeaders(req *http.Request) {
req.Header.Set("X-Client-Name", "go-stellar-sdk")
req.Header.Set("X-Client-Version", app.Version())
req.Header.Set("X-Client-Version", c.Version())
req.Header.Set("X-App-Name", c.AppName)
req.Header.Set("X-App-Version", c.AppVersion)
}
Expand Down Expand Up @@ -523,5 +521,10 @@ func (c *Client) Root() (root hProtocol.Root, err error) {
return
}

// Version returns the current version.
func (c *Client) Version() string {
return version
}

// ensure that the horizon client implements ClientInterface
var _ ClientInterface = &Client{}
5 changes: 5 additions & 0 deletions clients/horizonclient/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package horizonclient

// version is the current version of the horizonclient.
// This is updated for every release.
const version = "1.1"

0 comments on commit 9580c77

Please sign in to comment.