use httpsnoop to ensure http.ResponseWriter additional interfaces are preserved #388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Noticed this problem when going through the websocket upgrade flow. http.Hijacker is implemented by builtin response writers but not by the recordingResponseWriter.
Instead of doing all the leg work to ensure that interfaces are implemented correctly, convert things to use httpsnoop, which does codegen to generate the possible combinations of interface implementations so that things are preserved.
One question: given that the
recordingResponseWriter
initialization code now includes an additional set of allocations (fromhttpsnoop
, but also the closures for the hooks), is it worth it to keep the sync.Pool? My gut says no, but... ?