Skip to content

Commit

Permalink
fix: http example (#38)
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.
  • Loading branch information
achille-roussel authored Oct 17, 2024
2 parents 4f64b93 + 7193c36 commit fc22d41
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 fc22d41

Please sign in to comment.