Skip to content

Commit

Permalink
Merge pull request #2 from thnxdev/fix-json-header
Browse files Browse the repository at this point in the history
add utf-8 charset to application/json responses
  • Loading branch information
nehzata authored Jun 29, 2023
2 parents c8cbe20 + 1fa54af commit 03e5a17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/happy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func generateHandler(gctx *genContext, eps []endpoint, tree *tree) error {
w.L(" http.Error(w, `failed to encode response: ` + err.Error(), http.StatusInternalServerError)")
w.L(" return")
w.L("}")
w.L("w.Header().Set(\"Content-Type\", \"application/json\")")
w.L("w.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")")
w.L("w.Header().Set(\"Content-Length\", strconv.Itoa(len(data)))")
w.L("w.WriteHeader(http.StatusOK)")
w.L("w.Write(data)")
Expand Down

0 comments on commit 03e5a17

Please sign in to comment.