Skip to content

Commit

Permalink
Add missing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jul 15, 2019
1 parent 93a2f37 commit 6e8a7ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/httputil/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ func WriteJSON(w http.ResponseWriter, r *http.Request, code int, v interface{})
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
enc := json.NewEncoder(w)
if pretty, err := BoolFromQuery(r, "pretty", false); err == nil && pretty {
pretty, err := BoolFromQuery(r, "pretty", false)
if err != nil {
log.WithError(err).Warn("Failed to get bool from query")
}
if pretty {
enc.SetIndent("", " ")
}
if err, ok := v.(error); ok {
Expand Down

0 comments on commit 6e8a7ca

Please sign in to comment.