etcdhttp: add internalVersion

release-2.0
Xiang Li 2015-01-22 15:32:21 -08:00
parent 7d33a2686c
commit a77bf97c14
3 changed files with 4 additions and 3 deletions

View File

@ -335,7 +335,7 @@ func serveVersion(w http.ResponseWriter, r *http.Request) {
if !allowMethod(w, r.Method, "GET") {
return
}
w.Write([]byte("etcd " + version.Version))
fmt.Fprintf(w, `{"releaseVersion":"%s","internalVersion":"%s"}`, version.Version, version.InternalVersion)
}
// parseKeyRequest converts a received http.Request on keysPrefix to

View File

@ -1329,7 +1329,7 @@ func TestServeVersion(t *testing.T) {
if rw.Code != http.StatusOK {
t.Errorf("code=%d, want %d", rw.Code, http.StatusOK)
}
w := fmt.Sprintf("etcd %s", version.Version)
w := fmt.Sprintf(`{"releaseVersion":"%s","internalVersion":"%s"}`, version.Version, version.InternalVersion)
if g := rw.Body.String(); g != w {
t.Fatalf("body = %q, want %q", g, w)
}

View File

@ -17,5 +17,6 @@
package version
var (
Version = "2.0.0-rc.1"
Version = "2.0.0-rc.1"
InternalVersion = "2"
)