This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"context" | |
"sync/atomic" | |
"github.com/felixge/httpsnoop" | |
) | |
// BlockConsecutiveWriteHeader is a middleware that prevents multiple WriteHeader calls on the http.ResponseWriter. | |
// This scenario leads to a server-side errors that indicate a wrong handler implementation. Despite this being a | |
// useful information, often in prod applications we still don't want our logs to be flooded, and it's in these cases |