Skip to content

Commit

Permalink
update: change the api to /version
Browse files Browse the repository at this point in the history
  • Loading branch information
starsz committed Feb 3, 2021
1 parent b61a3b9 commit b22303d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/internal/handler/tool/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ func NewHandler() (handler.RouteRegister, error) {
}

func (h *Handler) ApplyRoute(r *gin.Engine) {
r.GET("/info", wgin.Wraps(h.Info))
r.GET("/version", wgin.Wraps(h.Version))
}

func (h *Handler) Info(c droplet.Context) (interface{}, error) {
func (h *Handler) Version(_ droplet.Context) (interface{}, error) {
hash, version := utils.GetHashAndVersion()
return &InfoOutput{
Hash: hash,
Expand Down
2 changes: 1 addition & 1 deletion api/internal/handler/tool/tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestInfo_Get(t *testing.T) {

hash, version := utils.GetHashAndVersion()

ret, err := h.Info(ctx)
ret, err := h.Version(ctx)
assert.Nil(t, err)
assert.Equal(t, &InfoOutput{
Hash: hash,
Expand Down
2 changes: 1 addition & 1 deletion api/test/e2e/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestInfo(t *testing.T) {
Desc: "get info",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Path: "/info",
Path: "/version",
ExpectStatus: http.StatusOK,
ExpectBody: []string{"commit_hash", "\"version\":\"master\""},
},
Expand Down

0 comments on commit b22303d

Please sign in to comment.