Skip to content

Commit

Permalink
fix: http example
Browse files Browse the repository at this point in the history
Remove the superfluous response.WriteHeader call.

https://pkg.go.dev/net/http#ResponseWriter:
> If [ResponseWriter.WriteHeader] has not yet been called, Write calls
> WriteHeader(http.StatusOK) before writing the data.

Signed-off-by: bluebrown <rainbowstack@gmail.com>
  • Loading branch information
bluebrown committed Oct 17, 2024
1 parent 4f64b93 commit 7193c36
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion examples/httpserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func main() {
server := &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
w.WriteHeader(http.StatusOK)
}),
}

Expand Down

0 comments on commit 7193c36

Please sign in to comment.