Skip to content

Commit

Permalink
Remove superfluous http status code setting
Browse files Browse the repository at this point in the history
  • Loading branch information
llemeurfr committed Mar 22, 2020
1 parent 646793a commit b6f04a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions frontend/api/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func GetDashboardInfos(w http.ResponseWriter, r *http.Request, s IServer) {
if err = enc.Encode(pub); err == nil {
// send json of correctly encoded user info
w.Header().Set("Content-Type", api.ContentType_JSON)
w.WriteHeader(http.StatusOK)
return
}

Expand All @@ -68,7 +67,6 @@ func GetDashboardBestSellers(w http.ResponseWriter, r *http.Request, s IServer)
if err = enc.Encode(pub); err == nil {
// send json of correctly encoded user info
w.Header().Set("Content-Type", api.ContentType_JSON)
w.WriteHeader(http.StatusOK)
return
}

Expand Down
6 changes: 2 additions & 4 deletions frontend/api/publication.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ func GetPublication(w http.ResponseWriter, r *http.Request, s IServer) {
if pub, err := s.PublicationAPI().Get(int64(id)); err == nil {
enc := json.NewEncoder(w)
if err = enc.Encode(pub); err == nil {
// send json of correctly encoded user info
// send a json serialization of the publication
w.Header().Set("Content-Type", api.ContentType_JSON)
w.WriteHeader(http.StatusOK)
return
}
problem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusInternalServerError)
Expand Down Expand Up @@ -124,9 +123,8 @@ func CheckPublicationByTitle(w http.ResponseWriter, r *http.Request, s IServer)
if pub, err := s.PublicationAPI().CheckByTitle(string(title)); err == nil {
enc := json.NewEncoder(w)
if err = enc.Encode(pub); err == nil {
// send json of correctly encoded user info
// send a json serialization of the boolean response
w.Header().Set("Content-Type", api.ContentType_JSON)
w.WriteHeader(http.StatusOK)
return
}
problem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusInternalServerError)
Expand Down

0 comments on commit b6f04a8

Please sign in to comment.