diff --git a/tsuru/http/transport.go b/tsuru/http/transport.go
index 61cf70cf..2f5b0f45 100644
--- a/tsuru/http/transport.go
+++ b/tsuru/http/transport.go
@@ -69,6 +69,7 @@ func (v *TerminalRoundTripper) RoundTrip(req *http.Request) (*http.Response, err
}
verbosity := getVerbosity()
req.Header.Add(verbosityHeader, strconv.Itoa(verbosity))
+ req.Header.Set("User-Agent", fmt.Sprintf("tsuru-client/%s", v.CurrentVersion))
req.Close = true
if verbosity >= TerminalClientOnlyRequest {
diff --git a/tsuru/http/transport_test.go b/tsuru/http/transport_test.go
index e6d620d6..216dd77d 100644
--- a/tsuru/http/transport_test.go
+++ b/tsuru/http/transport_test.go
@@ -18,7 +18,8 @@ func (s *S) TestVerboseRoundTripperDumpRequest(c *check.C) {
}()
out := new(bytes.Buffer)
r := TerminalRoundTripper{
- Stdout: out,
+ Stdout: out,
+ CurrentVersion: "1.0.0",
RoundTripper: &cmdtest.Transport{
Message: "Success!",
Status: http.StatusOK,
@@ -31,6 +32,7 @@ func (s *S) TestVerboseRoundTripperDumpRequest(c *check.C) {
c.Assert(out.String(), check.DeepEquals, "*************************** **********************************\n"+
"GET /users HTTP/1.1\r\n"+
"Host: localhost\r\n"+
+ "User-Agent: tsuru-client/1.0.0\r\n"+
"X-Tsuru-Verbosity: 1\r\n"+
"\r\n"+
"*************************** **********************************\n")
@@ -44,7 +46,8 @@ func (s *S) TestVerboseRoundTripperDumpRequestResponse2(c *check.C) {
out := new(bytes.Buffer)
r := TerminalRoundTripper{
- Stdout: out,
+ Stdout: out,
+ CurrentVersion: "1.2.0",
RoundTripper: &cmdtest.Transport{
Message: "Success!",
Status: http.StatusOK,
@@ -57,6 +60,7 @@ func (s *S) TestVerboseRoundTripperDumpRequestResponse2(c *check.C) {
c.Assert(out.String(), check.DeepEquals, "*************************** **********************************\n"+
"GET /users HTTP/1.1\r\n"+
"Host: localhost\r\n"+
+ "User-Agent: tsuru-client/1.2.0\r\n"+
"X-Tsuru-Verbosity: 2\r\n"+
"\r\n"+
"*************************** **********************************\n"+