Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
backend: add missing application/json header (#1020)
Browse files Browse the repository at this point in the history
Also, make sure the chartset is specified.
  • Loading branch information
x1ddos committed Sep 19, 2016
1 parent 5a9e0d6 commit 1e99773
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/handler.go
Expand Up @@ -657,7 +657,7 @@ func handleWipeout(w http.ResponseWriter, r *http.Request) {

// serveEasterEgg responds with an array of ASCII keys represented as integers.
func serveEasterEgg(w http.ResponseWriter, r *http.Request) {
w.Header().Set("content-type", "application/json")
w.Header().Set("Content-Type", "application/json;charset=utf-8")
ctx := newContext(r)

const alpha = "abcdefghijklmnopqrstuvwxyz"
Expand Down Expand Up @@ -754,7 +754,7 @@ func debugPush(w http.ResponseWriter, r *http.Request) {
return
}

w.Header().Set("Content-Type", "application/json")
w.Header().Set("Content-Type", "application/json;charset=utf-8")
dc := &dataChanges{}
if err := json.NewDecoder(r.Body).Decode(dc); err != nil {
writeJSONError(c, w, http.StatusBadRequest, err)
Expand Down Expand Up @@ -801,7 +801,7 @@ func debugNotify(w http.ResponseWriter, r *http.Request) {
return
}

w.Header().Set("Content-Type", "application/json")
w.Header().Set("Content-Type", "application/json;charset=utf-8")
n := &notification{}
if err := json.NewDecoder(r.Body).Decode(n); err != nil {
writeJSONError(c, w, http.StatusBadRequest, err)
Expand Down Expand Up @@ -872,6 +872,7 @@ func writeJSONError(c context.Context, w http.ResponseWriter, code int, err inte
if aerr, ok := err.(*apiError); ok {
code = aerr.code
}
w.Header().Set("Content-Type", "application/json;charset=utf-8")
w.WriteHeader(code)
fmt.Fprintf(w, `{"error": %q}`, err)
}
Expand Down

0 comments on commit 1e99773

Please sign in to comment.