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

Protect against multiple WriteHeader calls #6113

Closed

Conversation

stmcginnis
Copy link

In the RespWriterWrapper there was a logic issue. The instance tracks whether WriteHeader has been called or not, but was still attempting to call it again even when it had already been called.

This updates the internal implementation to recognize if it's already been called and make any additional attempts a no-op. This avoids errors bubbling up for "superfluous response.WriteHeader calls".

Closes: #6112

In the RespWriterWrapper there was a logic issue. The instance tracks
whether WriteHeader has been called or not, but was still attempting to
call it again even when it had already been called.

This updates the internal implementation to recognize if it's already
been called and make any additional attempts a no-op. This avoids errors
bubbling up for "superfluous response.WriteHeader calls".

Signed-off-by: Sean McGinnis <[email protected]>
@stmcginnis stmcginnis requested a review from a team September 12, 2024 17:03
@dmathieu
Copy link
Member

This is not the right fix, as you can see from the unit tests.

Are you using the latest release? 2 superfluous header issues were fixed in that latest release.

@stmcginnis
Copy link
Author

Thanks @dmathieu, I hadn't noticed the latest release. It looks like #6055 did the trick for me.

@stmcginnis stmcginnis closed this Sep 12, 2024
@stmcginnis stmcginnis deleted the superluous-write-header branch September 12, 2024 17:54
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.

superfluous response.WriteHeader call on errors
2 participants