When an http.ResponseWriter calls WriteHeader after calling Write it will log a statement to stderr: 2023/12/29 22:54:08 http: superfluous response.WriteHeader call from github.com/mvrilo/go-redoc.Redoc.Handler.func1 (redoc.go:96).
This is happening because the stdlib http code doesn't want the caller to set the response header after calling Write. This PR moves the call to WriteHeader above the Write call to prevent this log from being generated.
When an http.ResponseWriter calls
WriteHeader
after callingWrite
it will log a statement to stderr:2023/12/29 22:54:08 http: superfluous response.WriteHeader call from github.com/mvrilo/go-redoc.Redoc.Handler.func1 (redoc.go:96)
.This is happening because the stdlib http code doesn't want the caller to set the response header after calling Write. This PR moves the call to WriteHeader above the Write call to prevent this log from being generated.