Skip to content

Commit

Permalink
fix(api): support stored status requests to /dsstatus
Browse files Browse the repository at this point in the history
  • Loading branch information
b5 committed Jul 26, 2019
1 parent 615148d commit 880a7a3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions api/fsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,21 @@ func (h *FSIHandlers) statusHandler(w http.ResponseWriter, r *http.Request) {
return
}

alias := ref.AliasString()
res := []lib.StatusItem{}
if err = h.AliasStatus(&alias, &res); err != nil {
util.WriteErrResponse(w, http.StatusInternalServerError, fmt.Errorf("error getting status: %s", err.Error()))
return
if ref.Path != "" {
refStr := ref.String()
if err = h.StoredStatus(&refStr, &res); err != nil {
util.WriteErrResponse(w, http.StatusInternalServerError, fmt.Errorf("error getting status: %s", err.Error()))
return
}
} else {
alias := ref.AliasString()
if err = h.AliasStatus(&alias, &res); err != nil {
util.WriteErrResponse(w, http.StatusInternalServerError, fmt.Errorf("error getting status: %s", err.Error()))
return
}
}

util.WriteResponse(w, res)
}

Expand Down

0 comments on commit 880a7a3

Please sign in to comment.