Skip to content

Commit 797e653

Browse files
timucingelicielithrar
authored andcommitted
Call WriteHeader after setting other header(s) in the example (#442)
From the docs: Changing the header map after a call to WriteHeader (or Write) has no effect unless the modified headers are trailers.
1 parent 08e7f80 commit 797e653

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ package main
503503

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

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

0 commit comments

Comments
 (0)