Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trigger superfluous logs #11

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Don't trigger superfluous logs #11

merged 2 commits into from
Jan 19, 2024

Conversation

grindlemire
Copy link
Contributor

@grindlemire grindlemire commented Dec 30, 2023

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.

@mvrilo mvrilo merged commit 7cdf2a7 into mvrilo:master Jan 19, 2024
1 check failed
@mvrilo
Copy link
Owner

mvrilo commented Jan 19, 2024

Nice, thanks @grindlemire!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants