Skip to content

Commit

Permalink
Call WriteHeader after setting other header(s) in the example (#442)
Browse files Browse the repository at this point in the history
From the docs: Changing the header map after a call to WriteHeader (or
Write) has no effect unless the modified headers are
trailers.
  • Loading branch information
timucingelici authored and elithrar committed Jan 25, 2019
1 parent 08e7f80 commit 797e653
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ package main

func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
// A very simple health check.
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)

// In the future we could report back on the status of our DB, or our cache
// (e.g. Redis) by performing a simple PING, and include them in the response.
Expand Down

0 comments on commit 797e653

Please sign in to comment.