Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peteraba committed Apr 8, 2018
1 parent 9e7d81a commit d10b130
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func RenderJSON(w http.ResponseWriter, code int, value interface{}) {
w.WriteHeader(code)
err := json.NewEncoder(w).Encode(value)
if err != nil {
http.Error(w, err.Error(), code)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
Expand Down Expand Up @@ -117,7 +117,9 @@ func DynamicEndpoint(w http.ResponseWriter, r *http.Request) {
RenderJSON(w, code, eVal)
return
}
RenderJSON(w, http.StatusNotFound, NewResponse("apidemic: "+vars["endpoint"]+" has no "+r.Method+" endpoint"))

responseText := fmt.Sprintf("apidemic: %s has no %s endpoint", vars["endpoint"], r.Method)
RenderJSON(w, http.StatusNotFound, NewResponse(responseText)
}

// NewResponse helper for response JSON message
Expand Down

0 comments on commit d10b130

Please sign in to comment.