Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
api: fix bug with http.Error call
Browse files Browse the repository at this point in the history
We must return after calling http.Error.
  • Loading branch information
Francisco Souza committed Feb 19, 2015
1 parent 92fa56a commit 1a22127
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ func updateRepository(w http.ResponseWriter, r *http.Request) {
err = parseBody(r.Body, &repo)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
err = repository.Update(name, repo)
if err != nil && err.Error() == "not found" {
if err != nil && err == repository.ErrRepositoryNotFound {
http.Error(w, err.Error(), http.StatusNotFound)
} else if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 1a22127

Please sign in to comment.